Class DataType

java.lang.Object
org.apache.camel.spi.DataType

public class DataType extends Object
Represents the data type URN which is used for message data type contract.

Java class doesn't always explain the data type completely, for example XML and JSON data format is sometimes serialized as a String, InputStream or etc. The DataTypeAware message stores the DataType as a part of the message to carry those data type information even if it's marshaled, so that it could be leveraged to detect required Transformer and Validator. DataType URN consists of two parts, 'scheme' and 'name'. Its string representation is 'scheme:name' connected with colon. For example 'java:com.example.Order', 'xml:ABCOrder' or 'json:XYZOrder'. These type name other than java class name allows the message to carry the name of the message data structure even if it's marshaled.

The scheme can also be used to associate the same DataType with different Camel components. For example `http:cloud-events` and `aws-s3:cloud-events` where the scheme relates to the respective component's scheme. This information could be leveraged to detect required Transformer and Validator implementations provided as part of these components.

See Also:
  • Field Details

  • Constructor Details

    • DataType

      public DataType(String urn)
    • DataType

      public DataType(Class<?> clazz)
  • Method Details

    • getScheme

      public String getScheme()
    • getName

      public String getName()
    • getFullName

      public String getFullName()
    • isJavaType

      public boolean isJavaType()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isAnyType

      public static boolean isAnyType(DataType dataType)
    • isJavaType

      public static boolean isJavaType(DataType dataType)
    • equals

      public boolean equals(Object target)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object