Short Description
    CustomJavaTransformer Attributes
    Best Practices
    See also

    Short Description

    CustomJavaTransformer executes user-defined Java code.

    ComponentSame input metadataSorted inputsInputsOutputsEach to all outputsJavaCTLAuto-propagated metadata


    The number of ports depends on the Java code.


    By default, CustomJavaTransformer does not propagate metadata. Metadata propagation can be configured using the Metadata propagation algorithm and Metadata propagation algorithm class attributes.

    CustomJavaTransformer has no metadata templates.

    Requirements on metadata depend on a user-defined transformation.

    CustomJavaTransformer Attributes

    AttributeReqDescriptionPossible values
    Algorithm[1]A runnable transformation in Java defined in the graph. 
    Algorithm URL[1]A URL to an external file defining a runnable transformation in Java. 
    Algorithm class[1]An external runnable transformation class. 
    Metadata propagation algorithm An algorithm for metadata propagation written in Java. 
    Metadata propagation algorithm class An external metadata propagation class. 
    Algorithm source charset 

    The encoding of the external file defining the transformation.

    The default encoding depends on DEFAULT_SOURCE_CODE_CHARSET in defaultProperties.


    [1]  One of these must be set. These transformation attributes must be specified.


    CustomJavaTransformer executes the Java transformation. CustomJavaTransformer is a more specific CustomJavaComponent focused on transforming data.

    There are other similar Java components: CustomJavaReader, CustomJavaWriter and CustomJavaComponent. All these components use a transformation defined in Java, they differ in templates being used.

    You can use Public CloverDX API in this component. General parts of custom Java components and Public CloverDX API are described in CustomJavaComponent.

    Java Interfaces for CustomJavaTransformer

    A transformation required by the component must extend the org.jetel.component.AbstractGenericTransform class.

    The component has the same Java interface as CustomJavaComponent, but it provides a different Java template. See Java Interfaces for CustomJavaComponent.

    Custom Metadata Propagation for CustomJavaTransformer

    CustomJavaTransformer can propagate metadata using a custom algorithm. Metadata propagation algorithm must extend the org.jetel.component.GenericMetadataProvider class.

    The component has the same Java interface as CustomJavaComponent, see Custom Metadata Propagation for CustomJavaComponent.


    Record Duplicator

    Create a component duplicating input records.

    package jk;
    import org.jetel.component.AbstractGenericTransform;
    import org.jetel.exception.JetelRuntimeException;
     * This is an example custom transformer. It shows how you can
     * duplicate all incoming records.
    public class CustomJavaTransformerExample01 extends AbstractGenericTransform {
        public void execute() {
            try {
                DataRecord inRecord = inRecords[0];
                while ((inRecord = readRecordFromPort(0)) != null) {
                    writeRecordToPort(0, inRecord);
                    writeRecordToPort(0, inRecord);
            } catch (Exception e) {
                throw new JetelRuntimeException(e);

    Metadata on the input and output port must be the same for this example.

    Best Practices

    If the transformation is specified in an external file (with Algorithm URL), we recommend to explicitly specify Algorithm source charset.


    VersionCompatibility Notice

    CustomJavaTransformer is available since 4.1.0-M1. It replaced JavaExecute.


    CustomJavaTransformer can now propagate metadata - added new attributes Metadata propagation algorithm and Metadata propagation algorithm class.