public class UnmarshallerProperties extends Object
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json");
| Modifier and Type | Field and Description |
|---|---|
static String |
AUTO_DETECT_MEDIA_TYPE
The name of the property used to specify if the media type should be
auto detected (default is false).
|
static String |
BEAN_VALIDATION_FACTORY
Property for setting preferred or custom validator factory.
|
static String |
BEAN_VALIDATION_GROUPS
Property for setting bean validation target groups.
|
static String |
BEAN_VALIDATION_MODE
Property for setting bean validation mode.
|
static String |
BEAN_VALIDATION_NO_OPTIMISATION
Property for disabling Bean Validation optimisations.
|
static String |
DISABLE_SECURE_PROCESSING |
static String |
ID_RESOLVER
The name of the property used to specify a custom IDResolver class, to
allow customization of ID/IDREF processing.
|
static String |
JSON_ATTRIBUTE_PREFIX
The name of the property used to specify a value that will be prepended
to all keys that are mapped to an XML attribute.
|
static String |
JSON_INCLUDE_ROOT
The name of the property used to specify in the root node should be
included in the message (default is true).
|
static String |
JSON_NAMESPACE_PREFIX_MAPPER
The Constant JSON_NAMESPACE_PREFIX_MAPPER.
|
static String |
JSON_NAMESPACE_SEPARATOR
The name of the property used to specify the character (default is '.')
that separates the prefix from the key name.
|
static String |
JSON_TYPE_ATTRIBUTE_NAME
Override default type property name for JSON as MOXy type discriminator.
|
static String |
JSON_TYPE_COMPATIBILITY
If we should treat unqualified type property in JSON as MOXy type discriminator.
|
static String |
JSON_USE_XSD_TYPES_WITH_PREFIX
If there should be xsd prefix when using simple types, e.g.
|
static String |
JSON_VALUE_WRAPPER
The name of the property used to specify the key that will correspond to
the property mapped with @XmlValue.
|
static String |
JSON_WRAPPER_AS_ARRAY_NAME
The Constant JSON_WRAPPER_AS_ARRAY_NAME.
|
static String |
MEDIA_TYPE
The name of the property used to specify the type of binding to be
performed.
|
static String |
MOXY_LOG_PAYLOAD
Property for logging Entities content during marshalling/unmarshalling operation in MOXy.
|
static String |
MOXY_LOGGING_LEVEL
Property for MOXy logging level.
|
static String |
OBJECT_GRAPH |
static String |
UNMARSHALLING_CASE_INSENSITIVE
If set to Boolean.TRUE,
JAXBUnmarshaller will match
XML Elements and XML Attributes to Java fields case insensitively. |
| Constructor and Description |
|---|
UnmarshallerProperties() |
public static final String ID_RESOLVER
IDResolver,
Constant Field Valuespublic static final String JSON_ATTRIBUTE_PREFIX
public static final String JSON_INCLUDE_ROOT
JAXBContextProperties.JSON_INCLUDE_ROOT,
MarshallerProperties.JSON_INCLUDE_ROOT,
Constant Field Valuespublic static final String JSON_NAMESPACE_PREFIX_MAPPER
NamespacePrefixMapper,
Constant Field Valuespublic static final String JSON_NAMESPACE_SEPARATOR
public static final String JSON_VALUE_WRAPPER
JAXBContextProperties.JSON_VALUE_WRAPPER,
MarshallerProperties.JSON_VALUE_WRAPPER,
Constant Field Valuespublic static final String JSON_USE_XSD_TYPES_WITH_PREFIX
public static final String JSON_TYPE_COMPATIBILITY
public static final String JSON_TYPE_ATTRIBUTE_NAME
Example
Given the following property
unmarshaller.setProperty(UnmarshallerProperties.JSON_TYPE_ATTRIBUTE_NAME, "mytype");
If the property is set the valid JSON input will be:
...
{
"mytype": "phone",
"contactId": 3,
"number": "987654321"
}
...
for following object model
@XmlSeeAlso({Address.class, Phone.class})
public class Contact {
public int contactId;
...
public class Phone extends Contact{
public String number;
...
If the property is not set (default value) the valid JSON input will be:
...
{
"type": "phone",
"contactId": 3,
"number": "987654321"
}
...
Unmarshaller will use it as type discriminator to select right child class.public static final String MEDIA_TYPE
JAXBContextProperties.MEDIA_TYPE,
MarshallerProperties.MEDIA_TYPE,
MediaType,
Constant Field Valuespublic static final String AUTO_DETECT_MEDIA_TYPE
MEDIA_TYPE,
MediaType,
Constant Field Valuespublic static final String OBJECT_GRAPH
public static final String JSON_WRAPPER_AS_ARRAY_NAME
Example
Given the following class:
@XmlAccessorType(XmlAccessType.FIELD)
public class Customer {
@XmlElementWrapper(name="phone-numbers")
@XmlElement(name="phone-number")
private List<PhoneNumber> phoneNumbers;
}
If the property is set to false (the default) the JSON output will be:
{
"phone-numbers" : {
"phone-number" : [ {
...
}, {
...
}]
}
}
And if the property is set to true, then the JSON output will be:
{
"phone-numbers" : [ {
...
}, {
...
}]
}
public static final String UNMARSHALLING_CASE_INSENSITIVE
JAXBUnmarshaller will match
XML Elements and XML Attributes to Java fields case insensitively.
Example
Given the following class:
@XmlAccessorType(XmlAccessType.FIELD)
public class Customer {
@XmlElement
private String name;
@XmlAttribute
private int id;
}
If the property is set to true, the following XML object will match the class and will be unmarshalled.
<customer iD="007"> <nAMe>cafeBabe</nAMe> </customer>
By default, case-insensitive unmarshalling is turned off.
The property can be set through JAXBUnmarshaller.setProperty(String, Object).
public static final String BEAN_VALIDATION_MODE
BeanValidationMode.AUTO (default),BeanValidationMode.CALLBACK, BeanValidationMode.NONE.public static final String BEAN_VALIDATION_FACTORY
ValidatorFactory.public static final String BEAN_VALIDATION_GROUPS
public static final String BEAN_VALIDATION_NO_OPTIMISATION
Boolean.TRUE to disable optimisations, set to Boolean.FALSE to re-enable them
again.public static final String DISABLE_SECURE_PROCESSING
public static final String MOXY_LOGGING_LEVEL
LogLevel
Default value is LogLevel.INFOJAXBContextProperties.MOXY_LOGGING_LEVEL,
MarshallerProperties.MOXY_LOGGING_LEVEL,
LogLevel,
Constant Field Valuespublic static final String MOXY_LOG_PAYLOAD
Boolean.TRUE to enable payload logging, set to Boolean.FALSE to disable it.
It can be set via system property with name "eclipselink.logging.payload.moxy" too.
By default it is disabled.JAXBContextProperties.MOXY_LOG_PAYLOAD,
MarshallerProperties.MOXY_LOG_PAYLOAD,
Constant Field ValuesCopyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.