Class XStreamDataFormat
- java.lang.Object
-
- org.apache.camel.model.IdentifiedType
-
- org.apache.camel.model.DataFormatDefinition
-
- org.apache.camel.model.dataformat.XStreamDataFormat
-
- All Implemented Interfaces:
ContentTypeHeaderAware
@Metadata(firstVersion="1.3.0", label="dataformat,transformation,xml,json", title="XStream") public class XStreamDataFormat extends DataFormatDefinition implements ContentTypeHeaderAware
Marshal and unmarshal POJOs to/from XML using XStream library.
-
-
Constructor Summary
Constructors Constructor Description XStreamDataFormat()
XStreamDataFormat(String encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<PropertyDefinition>
getAliases()
Map<String,String>
getAliasesAsMap()
String
getContentTypeHeader()
Whether the data format should set the Content-Type header with the type from the data format.List<PropertyDefinition>
getConverters()
Map<String,String>
getConvertersAsMap()
String
getDataFormatName()
String
getDriver()
String
getDriverRef()
String
getEncoding()
List<PropertyDefinition>
getImplicitCollections()
Map<String,String>
getImplicitCollectionsAsMap()
String
getMode()
List<PropertyDefinition>
getOmitFields()
Map<String,String>
getOmitFieldsAsMap()
String
getPermissions()
void
setAliases(List<PropertyDefinition> aliases)
Alias a Class to a shorter name to be used in XML elements.void
setAliases(Map<String,String> aliases)
void
setContentTypeHeader(String contentTypeHeader)
Whether the data format should set the Content-Type header with the type from the data format.void
setConverters(List<PropertyDefinition> converters)
List of class names for using custom XStream converters.void
setConverters(Map<String,String> converters)
void
setDriver(String driver)
To use a custom XStream driver.void
setDriverRef(String driverRef)
To refer to a custom XStream driver to lookup in the registry.void
setEncoding(String encoding)
Sets the encoding to usevoid
setImplicitCollections(List<PropertyDefinition> implicitCollections)
Adds a default implicit collection which is used for any unmapped XML tag.void
setImplicitCollections(Map<String,String> implicitCollections)
void
setMode(String mode)
Mode for dealing with duplicate references The possible values are: NO_REFERENCES ID_REFERENCES XPATH_RELATIVE_REFERENCES XPATH_ABSOLUTE_REFERENCES SINGLE_NODE_XPATH_RELATIVE_REFERENCES SINGLE_NODE_XPATH_ABSOLUTE_REFERENCESvoid
setOmitFields(List<PropertyDefinition> omitFields)
Prevents a field from being serialized.void
setOmitFields(Map<String,String> aliases)
void
setPermissions(Class<?>... type)
To add permission for the given pojo classes.void
setPermissions(String permissions)
Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans.-
Methods inherited from class org.apache.camel.model.DataFormatDefinition
getDataFormat, getShortName, setDataFormat, setDataFormatName
-
Methods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
-
-
-
-
Constructor Detail
-
XStreamDataFormat
public XStreamDataFormat()
-
XStreamDataFormat
public XStreamDataFormat(String encoding)
-
-
Method Detail
-
getDataFormatName
public String getDataFormatName()
- Overrides:
getDataFormatName
in classDataFormatDefinition
-
getEncoding
public String getEncoding()
-
setEncoding
public void setEncoding(String encoding)
Sets the encoding to use
-
getDriver
public String getDriver()
-
setDriver
public void setDriver(String driver)
To use a custom XStream driver. The instance must be of type com.thoughtworks.xstream.io.HierarchicalStreamDriver
-
getDriverRef
public String getDriverRef()
-
setDriverRef
public void setDriverRef(String driverRef)
To refer to a custom XStream driver to lookup in the registry. The instance must be of type com.thoughtworks.xstream.io.HierarchicalStreamDriver
-
getMode
public String getMode()
-
setMode
public void setMode(String mode)
Mode for dealing with duplicate references The possible values are:- NO_REFERENCES
- ID_REFERENCES
- XPATH_RELATIVE_REFERENCES
- XPATH_ABSOLUTE_REFERENCES
- SINGLE_NODE_XPATH_RELATIVE_REFERENCES
- SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES
-
getConverters
public List<PropertyDefinition> getConverters()
-
setConverters
public void setConverters(List<PropertyDefinition> converters)
List of class names for using custom XStream converters. The classes must be of type com.thoughtworks.xstream.converters.Converter
-
getAliases
public List<PropertyDefinition> getAliases()
-
setAliases
public void setAliases(List<PropertyDefinition> aliases)
Alias a Class to a shorter name to be used in XML elements.
-
getOmitFields
public List<PropertyDefinition> getOmitFields()
-
setOmitFields
public void setOmitFields(List<PropertyDefinition> omitFields)
Prevents a field from being serialized. To omit a field you must always provide the declaring type and not necessarily the type that is converted. Multiple values can be separated by comma.
-
getImplicitCollections
public List<PropertyDefinition> getImplicitCollections()
-
setImplicitCollections
public void setImplicitCollections(List<PropertyDefinition> implicitCollections)
Adds a default implicit collection which is used for any unmapped XML tag. Multiple values can be separated by comma.
-
getPermissions
public String getPermissions()
-
setPermissions
public void setPermissions(String permissions)
Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny.
Wildcards is supported by using .* as prefix. For example to allow com.foo and all subpackages then specify +com.foo.*. Multiple permissions can be configured separated by comma, such as +com.foo.*,-com.foo.bar.MySecretBean.
The following default permission is always included: "-*,java.lang.*,java.util.*" unless its overridden by specifying a JVM system property with they key org.apache.camel.xstream.permissions.
-
setPermissions
public void setPermissions(Class<?>... type)
To add permission for the given pojo classes.- Parameters:
type
- the pojo class(es) xstream should use as allowed permission- See Also:
setPermissions(String)
-
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
-
-