One Star

How to define User defined methods and classes using tJava component

Hi All,
I am using TOS2.0 java version. In my job, i need to use some user defined methods in Mappings, like output column1=Myclass1.myMethod1(Input_table.column1).
Where can i define MyClass and myMethod(Userdefined classes and methods)?
How can we do this using tJava component?
1 REPLY
Employee

Re: How to define User defined methods and classes using tJava component

Hi Venky,
To use your own function in your project, you can include this specific functions in the repository "Code -> Rountines".
Create your routine (right-click "Create routine"), the name of your Routine must be the name of your Class created.
For example : MyTest for the Creation routine Label.
In my template :
//template routine Java
package routines;
public class MyTest {
public static String helloExemple(String message) {
if (message == null) {
message = "World";
}
return message;
}
}
Then, you save your own code, and in your Job (property field component, or tMap) you can call this method directly (see the screenshot).
Regards.