Class JaxbDataFormat
- java.lang.Object
-
- org.apache.camel.model.IdentifiedType
-
- org.apache.camel.model.DataFormatDefinition
-
- org.apache.camel.model.dataformat.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 Summary
Constructors Constructor Description JaxbDataFormat()
JaxbDataFormat(boolean prettyPrint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentTypeHeader()
Whether the data format should set the Content-Type header with the type from the data format.String
getContextPath()
String
getContextPathIsClassName()
String
getEncoding()
String
getFilterNonXmlChars()
String
getFragment()
String
getIgnoreJAXBElement()
String
getJaxbProviderProperties()
String
getMustBeJAXBElement()
String
getNamespacePrefixRef()
String
getNoNamespaceSchemaLocation()
String
getObjectFactory()
String
getPartClass()
String
getPartNamespace()
String
getPrettyPrint()
String
getSchema()
String
getSchemaLocation()
String
getSchemaSeverityLevel()
String
getXmlStreamWriterWrapper()
void
setContentTypeHeader(String contentTypeHeader)
Whether the data format should set the Content-Type header with the type from the data format.void
setContextPath(String contextPath)
Package name where your JAXB classes are located.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.void
setEncoding(String encoding)
To overrule and use a specific encodingvoid
setFilterNonXmlChars(String filterNonXmlChars)
To ignore non xml characheters and replace them with an empty space.void
setFragment(String fragment)
To turn on marshalling XML fragment trees.void
setIgnoreJAXBElement(String ignoreJAXBElement)
Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases.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.void
setMustBeJAXBElement(String mustBeJAXBElement)
Whether marhsalling must be java objects with JAXB annotations.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.void
setNoNamespaceSchemaLocation(String schemaLocation)
To define the location of the namespaceless schemavoid
setObjectFactory(String objectFactory)
Whether to allow using ObjectFactory classes to create the POJO classes during marshalling.void
setPartClass(String partClass)
Name of class used for fragment parsing.void
setPartNamespace(String partNamespace)
XML namespace to use for fragment parsing.void
setPrettyPrint(String prettyPrint)
To enable pretty printing output nicely formatted.void
setSchema(String schema)
To validate against an existing schema.void
setSchemaLocation(String schemaLocation)
To define the location of the schemavoid
setSchemaSeverityLevel(String schemaSeverityLevel)
Sets the schema severity level to use when validating against a schema.void
setXmlStreamWriterWrapper(String xmlStreamWriterWrapperRef)
To use a custom xml stream writer.-
Methods inherited from class org.apache.camel.model.DataFormatDefinition
getDataFormat, getDataFormatName, getShortName, setDataFormat, setDataFormatName
-
Methods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
-
-
-
-
Method Detail
-
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 interfaceContentTypeHeaderAware
-
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 interfaceContentTypeHeaderAware
-
-