Class JaxbDataFormat

All Implemented Interfaces:
ContentTypeHeaderAware

@Metadata(firstVersion="1.0.0", label="dataformat,transformation,xml", title="JAXB") public class JaxbDataFormat extends DataFormatDefinition implements ContentTypeHeaderAware
Unmarshal XML payloads to POJOs and back using JAXB2 XML marshalling standard.
  • Constructor Details

    • JaxbDataFormat

      public JaxbDataFormat()
    • JaxbDataFormat

      public JaxbDataFormat(boolean prettyPrint)
  • Method Details

    • getContextPath

      public String getContextPath()
    • setContextPath

      public void setContextPath(String contextPath)
      Package name where your JAXB classes are located.
    • getContextPathIsClassName

      public String getContextPathIsClassName()
    • setContextPathIsClassName

      public void setContextPathIsClassName(String contextPathIsClassName)
      This can be set to true to mark that the contextPath is referring to a classname and not a package name.
    • getSchema

      public String getSchema()
    • setSchema

      public void setSchema(String schema)
      To validate against an existing schema. Your can use the prefix classpath:, file:* or *http: to specify how the resource should be resolved. You can separate multiple schema files by using the ',' character.
    • getSchemaSeverityLevel

      public String getSchemaSeverityLevel()
    • setSchemaSeverityLevel

      public void setSchemaSeverityLevel(String schemaSeverityLevel)
      Sets the schema severity level to use when validating against a schema. This level determines the minimum severity error that triggers JAXB to stop continue parsing. The default value of 0 (warning) means that any error (warning, error or fatal error) will trigger JAXB to stop. There are the following three levels: 0=warning, 1=error, 2=fatal error.
    • getPrettyPrint

      public String getPrettyPrint()
    • setPrettyPrint

      public void setPrettyPrint(String prettyPrint)
      To enable pretty printing output nicely formatted.

      Is by default false.

    • getObjectFactory

      public String getObjectFactory()
    • setObjectFactory

      public void setObjectFactory(String objectFactory)
      Whether to allow using ObjectFactory classes to create the POJO classes during marshalling. This only applies to POJO classes that has not been annotated with JAXB and providing jaxb.index descriptor files.
    • getIgnoreJAXBElement

      public String getIgnoreJAXBElement()
    • setIgnoreJAXBElement

      public void setIgnoreJAXBElement(String ignoreJAXBElement)
      Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases.
    • getMustBeJAXBElement

      public String getMustBeJAXBElement()
    • setMustBeJAXBElement

      public void setMustBeJAXBElement(String mustBeJAXBElement)
      Whether marhsalling must be java objects with JAXB annotations. And if not then it fails. This option can be set to false to relax that, such as when the data is already in XML format.
    • setFragment

      public void setFragment(String fragment)
      To turn on marshalling XML fragment trees. By default JAXB looks for @XmlRootElement annotation on given class to operate on whole XML tree. This is useful but not always - sometimes generated code does not have @XmlRootElement annotation, sometimes you need unmarshall only part of tree. In that case you can use partial unmarshalling. To enable this behaviours you need set property partClass. Camel will pass this class to JAXB's unmarshaler.
    • getFragment

      public String getFragment()
    • getFilterNonXmlChars

      public String getFilterNonXmlChars()
    • setFilterNonXmlChars

      public void setFilterNonXmlChars(String filterNonXmlChars)
      To ignore non xml characheters and replace them with an empty space.
    • getEncoding

      public String getEncoding()
    • setEncoding

      public void setEncoding(String encoding)
      To overrule and use a specific encoding
    • getPartClass

      public String getPartClass()
    • setPartClass

      public void setPartClass(String partClass)
      Name of class used for fragment parsing.

      See more details at the fragment option.

    • getPartNamespace

      public String getPartNamespace()
    • setPartNamespace

      public void setPartNamespace(String partNamespace)
      XML namespace to use for fragment parsing.

      See more details at the fragment option.

    • getNamespacePrefixRef

      public String getNamespacePrefixRef()
    • setNamespacePrefixRef

      public void setNamespacePrefixRef(String namespacePrefixRef)
      When marshalling using JAXB or SOAP then the JAXB implementation will automatic assign namespace prefixes, such as ns2, ns3, ns4 etc. To control this mapping, Camel allows you to refer to a map which contains the desired mapping.
    • getXmlStreamWriterWrapper

      public String getXmlStreamWriterWrapper()
    • setXmlStreamWriterWrapper

      public void setXmlStreamWriterWrapper(String xmlStreamWriterWrapperRef)
      To use a custom xml stream writer.
    • getSchemaLocation

      public String getSchemaLocation()
    • setSchemaLocation

      public void setSchemaLocation(String schemaLocation)
      To define the location of the schema
    • getNoNamespaceSchemaLocation

      public String getNoNamespaceSchemaLocation()
    • setNoNamespaceSchemaLocation

      public void setNoNamespaceSchemaLocation(String schemaLocation)
      To define the location of the namespaceless schema
    • getJaxbProviderProperties

      public String getJaxbProviderProperties()
    • setJaxbProviderProperties

      public void setJaxbProviderProperties(String jaxbProviderProperties)
      Refers to a custom java.util.Map to lookup in the registry containing custom JAXB provider properties to be used with the JAXB marshaller.
    • getContentTypeHeader

      public String getContentTypeHeader()
      Description copied from interface: ContentTypeHeaderAware
      Whether the data format should set the Content-Type header with the type from the data format.

      For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON etc.

      Specified by:
      getContentTypeHeader in interface ContentTypeHeaderAware
    • setContentTypeHeader

      public void setContentTypeHeader(String contentTypeHeader)
      Description copied from interface: ContentTypeHeaderAware
      Whether the data format should set the Content-Type header with the type from the data format.

      For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON etc.

      Specified by:
      setContentTypeHeader in interface ContentTypeHeaderAware
    • getAccessExternalSchemaProtocols

      public String getAccessExternalSchemaProtocols()
    • setAccessExternalSchemaProtocols

      public void setAccessExternalSchemaProtocols(String accessExternalSchemaProtocols)
      Only in use if schema validation has been enabled. Restrict access to the protocols specified for external reference set by the schemaLocation attribute, Import and Include element. Examples of protocols are file, http, jar:file. false or none to deny all access to external references; a specific protocol, such as file, to give permission to only the protocol; the keyword all to grant permission to all protocols.