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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhether the data format should set the Content-Type header with the type from the data format.voidsetAccessExternalSchemaProtocols(String accessExternalSchemaProtocols) Only in use if schema validation has been enabled.voidsetContentTypeHeader(String contentTypeHeader) Whether the data format should set the Content-Type header with the type from the data format.voidsetContextPath(String contextPath) Package name where your JAXB classes are located.voidsetContextPathIsClassName(String contextPathIsClassName) This can be set to true to mark that the contextPath is referring to a classname and not a package name.voidsetEncoding(String encoding) To overrule and use a specific encodingvoidsetFilterNonXmlChars(String filterNonXmlChars) To ignore non xml characheters and replace them with an empty space.voidsetFragment(String fragment) To turn on marshalling XML fragment trees.voidsetIgnoreJAXBElement(String ignoreJAXBElement) Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases.voidsetJaxbProviderProperties(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.voidsetMustBeJAXBElement(String mustBeJAXBElement) Whether marhsalling must be java objects with JAXB annotations.voidsetNamespacePrefixRef(String namespacePrefixRef) When marshalling using JAXB or SOAP then the JAXB implementation will automatic assign namespace prefixes, such as ns2, ns3, ns4 etc.voidsetNoNamespaceSchemaLocation(String schemaLocation) To define the location of the namespaceless schemavoidsetObjectFactory(String objectFactory) Whether to allow using ObjectFactory classes to create the POJO classes during marshalling.voidsetPartClass(String partClass) Name of class used for fragment parsing.voidsetPartNamespace(String partNamespace) XML namespace to use for fragment parsing.voidsetPrettyPrint(String prettyPrint) To enable pretty printing output nicely formatted.voidTo validate against an existing schema.voidsetSchemaLocation(String schemaLocation) To define the location of the schemavoidsetSchemaSeverityLevel(String schemaSeverityLevel) Sets the schema severity level to use when validating against a schema.voidsetXmlStreamWriterWrapper(String xmlStreamWriterWrapperRef) To use a custom xml stream writer.Methods inherited from class org.apache.camel.model.DataFormatDefinition
getDataFormat, getDataFormatName, getShortName, setDataFormat, setDataFormatNameMethods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
-
Constructor Details
-
JaxbDataFormat
public JaxbDataFormat() -
JaxbDataFormat
public JaxbDataFormat(boolean prettyPrint)
-
-
Method Details
-
getContextPath
-
setContextPath
Package name where your JAXB classes are located. -
getContextPathIsClassName
-
setContextPathIsClassName
This can be set to true to mark that the contextPath is referring to a classname and not a package name. -
getSchema
-
setSchema
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
-
setSchemaSeverityLevel
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
-
setPrettyPrint
To enable pretty printing output nicely formatted. Is by default false. -
getObjectFactory
-
setObjectFactory
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
-
setIgnoreJAXBElement
Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases. -
getMustBeJAXBElement
-
setMustBeJAXBElement
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
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
-
getFilterNonXmlChars
-
setFilterNonXmlChars
To ignore non xml characheters and replace them with an empty space. -
getEncoding
-
setEncoding
To overrule and use a specific encoding -
getPartClass
-
setPartClass
Name of class used for fragment parsing. See more details at the fragment option. -
getPartNamespace
-
setPartNamespace
XML namespace to use for fragment parsing. See more details at the fragment option. -
getNamespacePrefixRef
-
setNamespacePrefixRef
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
-
setXmlStreamWriterWrapper
To use a custom xml stream writer. -
getSchemaLocation
-
setSchemaLocation
To define the location of the schema -
getNoNamespaceSchemaLocation
-
setNoNamespaceSchemaLocation
To define the location of the namespaceless schema -
getJaxbProviderProperties
-
setJaxbProviderProperties
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
Description copied from interface:ContentTypeHeaderAwareWhether 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:
getContentTypeHeaderin interfaceContentTypeHeaderAware
-
setContentTypeHeader
Description copied from interface:ContentTypeHeaderAwareWhether 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:
setContentTypeHeaderin interfaceContentTypeHeaderAware
-
getAccessExternalSchemaProtocols
-
setAccessExternalSchemaProtocols
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.
-