Class TransformerDefinition

java.lang.Object
org.apache.camel.model.transformer.TransformerDefinition
Direct Known Subclasses:
CustomTransformerDefinition, DataFormatTransformerDefinition, EndpointTransformerDefinition

@Metadata(label="transformation") public abstract class TransformerDefinition extends Object
Represents a Transformer which declarative transforms message content according to the input type declared by InputTypeDefinition and/or output type declared by OutputTypeDefinition. If you specify from='java:com.example.ABC' and to='xml:XYZ', the transformer will be picked up when current message type is 'java:com.example.ABC' and expected message type is 'xml:XYZ'. If you specify from='java' to='xml', then it will be picked up for all of Java to xml transformation. Also it's possible to specify scheme='xml' so that the transformer will be picked up for all of Java to xml and xml to java transformation.
  • Constructor Details

    • TransformerDefinition

      public TransformerDefinition()
  • Method Details

    • getScheme

      public String getScheme()
    • setScheme

      public void setScheme(String scheme)
      Set a scheme name supported by the transformer. If you specify 'csv', the transformer will be picked up for all of 'csv' from/to Java transformation. Note that the scheme matching is performed only when no exactly matched transformer exists.
      Parameters:
      scheme - scheme name
    • getFromType

      public String getFromType()
    • setFromType

      public void setFromType(String from)
      Set the 'from' data type name. If you specify 'xml:XYZ', the transformer will be picked up if source type is 'xml:XYZ'. If you specify just 'xml', the transformer matches with all of 'xml' source type like 'xml:ABC' or 'xml:DEF'.
      Parameters:
      from - 'from' data type name
    • setFromType

      public void setFromType(Class<?> clazz)
      Set the 'from' data type using Java class.
      Parameters:
      clazz - 'from' Java class
    • getToType

      public String getToType()
    • setToType

      public void setToType(String to)
      Set the 'to' data type name. If you specify 'json:XYZ', the transformer will be picked up if destination type is 'json:XYZ'. If you specify just 'json', the transformer matches with all of 'json' destination type like 'json:ABC' or 'json:DEF'.
      Parameters:
      to - 'to' data type name
    • setToType

      public void setToType(Class<?> clazz)
      Set the 'to' data type using Java class.
      Parameters:
      clazz - 'to' Java class