bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.55k stars 330 forks source link

How to define customised Functions #1240

Closed G-Balamurugan closed 6 months ago

G-Balamurugan commented 7 months ago

Whether it is possible to invoke a function in Jolt , like invoking a function and assigning the return value to a fields , If possible can you guide me with a example

gbouget commented 6 months ago

I don't know if it's the best solution, but it works:

  1. Create a class that implements com.bazaarvoice.jolt.SpecDriven and com.bazaarvoice.jolt.Transform.
  2. In the class variable that links the function name to the method to be executed (Map<String, Function> STOCK_FUNCTIONS), add the name of your custom function (key), and, in the value, the method to be executed that is to extend com.bazaarvoice.jolt.modifier.function.Function.

For further details, you can read https://github.com/bazaarvoice/jolt/issues/1091.

priyadharshini13 commented 6 months ago

Please unsubscribe me from the email.ThanksPriyaSent from my iPhoneOn 9 Mar 2024, at 14:38, Gaëtan Bouget @.***> wrote: I don't know if it's the best solution, but it works:

Create a class that implements com.bazaarvoice.jolt.SpecDriven and com.bazaarvoice.jolt.Transform. In the class variable that links the function name to the method to be executed (Map<String, Function> STOCK_FUNCTIONS), add the name of your custom function (key) and the method to be executed that is to extend com.bazaarvoice.jolt.modifier.function.Function.

For further details, you can read #1091.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

G-Balamurugan commented 6 months ago

Thank you