public class MarshallerProperties extends Object
Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");
Modifier and Type | Field and Description |
---|---|
static String |
CHARACTER_ESCAPE_HANDLER
The Constant CHARACTER_ESCAPE_HANDLER.
|
static String |
INDENT_STRING
The Constant INDENT_STRING.
|
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_MARSHAL_EMPTY_COLLECTIONS
The Constant JSON_MARSHAL_EMPTY_COLLECTIONS.
|
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_REDUCE_ANY_ARRAYS
The Constant JSON_REDUCE_ANY_ARRAYS.
|
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 |
NAMESPACE_PREFIX_MAPPER
The Constant NAMESPACE_PREFIX_MAPPER.
|
static String |
OBJECT_GRAPH |
Constructor and Description |
---|
MarshallerProperties() |
public static final String CHARACTER_ESCAPE_HANDLER
CharacterEscapeHandler
,
Constant Field Valuespublic static final String INDENT_STRING
public static final String JSON_ATTRIBUTE_PREFIX
org.eclipse.persistence.jaxb.JAXBContextProperties.JSON_ATTRIBUTE_PREFIX
,
org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_ATTRIBUTE_PREFIX
,
Constant Field Valuespublic static final String JSON_INCLUDE_ROOT
org.eclipse.persistence.jaxb.JAXBContextProperties.JSON_INCLUDE_ROOT
,
org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_INCLUDE_ROOT
,
Constant Field Valuespublic static final String JSON_NAMESPACE_SEPARATOR
org.eclipse.persistence.jaxb.JAXBContextProperties.NAMESPACE_SEPARATOR
,
org.eclipse.persistence.jaxb.UnmarshallerProperties.NAMESPACE_SEPARATOR
,
Constant Field Valuespublic static final String JSON_VALUE_WRAPPER
org.eclipse.persistence.jaxb.JAXBContextPropertes.JSON_VALUE_WRAPPER
,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_VALUE_WRAPPER
,
Constant Field Valuespublic static final String MEDIA_TYPE
org.eclipse.persistence.jaxb.JAXBContextProperties.MEDIA_TYPE
,
org.eclipse.persistence.jaxb.UnmarshallerProperties.MEDIA_TYPE
,
MediaType
,
Constant Field Valuespublic static final String NAMESPACE_PREFIX_MAPPER
NamespacePrefixMapper
,
Constant Field Valuespublic static final String JSON_MARSHAL_EMPTY_COLLECTIONS
public static final String JSON_REDUCE_ANY_ARRAYS
public 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 ListphoneNumbers; }
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" : [ { ... }, { ... }] }
org.eclipse.persistence.jaxb.JAXBContextProperties.JSON_WRAPPER_AS_ARRAY_NAME
,
org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME
,
Constant Field ValuesEclipseLink 2.5.2, "build v20140319-9ad6abd" API Reference