Use the Java Code tab to define, compile, and fix compilation errors in Java code. Create code snippets in the code entry tabs.
When you define the java code, you can perform the following task:
Define static code or a static block, instance variables, and user-defined methods.
Define Java expressions, and define transformation logic.
Use Java transformation API methods and standard Java language constructs.
Import third-party Java APIs, built-in Java packages, or custom Java packages. You can use Java code snippets from Java packages.
After you develop code snippets, you can compile the Java code and view the results of the compilation in the Output window or view the full Java code.
The Java Code tab contains the following components:
Navigator.
Add input or output ports or APIs to a code snippet. The Navigator lists the input and output ports for the transformation, the available Java transformation APIs, and a description of the port or API function. For input and output ports, the description includes the port name, type, datatype, precision, and scale. For API functions, the description includes the syntax and use of the API function.
The Navigator disables any port or API function that is unavailable for the code entry tab. For example, you cannot add ports or call API functions from the Import Packages code entry tab.
Code window.
Develop Java code for the transformation. The code window uses basic Java syntax highlighting.
Code entry tabs.
Define transformation behavior. Each code entry tab has an associated Code window. To enter Java code for a code entry tab, click the tab and write Java code in the Code window.
Define Expression link.
Opens the Define Expression dialog box that you use to create Java expressions.
Settings link.
Opens the Settings dialog box. Use the Settings dialog box to set the classpath for third-party and custom Java packages, to enable high precision for Decimal datatypes, and to process subsecond data. The PowerCenter Client includes files within the classpath when it compiles the java code.
Compile link.
Compiles the Java code for the transformation. Output from the Java compiler, including error and informational messages, appears in the Output window.
Full Code link
. Opens the Full Code window to display the complete class code for the Java transformation. The complete code for the transformation includes the Java code from the code entry tabs added to the Java transformation class template.
Output window.
Displays the compilation results for the Java transformation class. You can right-click an error message in the Output window to locate the error in the snippet code or the full code for the Java transformation class in the Full Code window. You can also double-click an error in the Output window to locate the source of the error.