public enum XmlFormat extends Enum<XmlFormat>
Enum Constant and Description |
---|
ATTR
Render a bean property as an attribute instead of an element.
|
ATTRS
Render property as attributes instead of an element.
|
COLLAPSED
Prevents collections and arrays from being enclosed in
|
DEFAULT
Normal formatting (default).
|
ELEMENT
Render property as an element instead of an attribute.
|
ELEMENTS
Render property value directly as the contents of the element.
|
MIXED
Same as
ELEMENTS except primitive types (e.g. |
MIXED_PWS
Same as
MIXED , but whitespace in text nodes are not trimmed during parsing. |
TEXT
Render property value as the text content of the element.
|
TEXT_PWS
Same as
TEXT , but whitespace in text node is not trimmed during parsing. |
VOID
Identifies a void element.
|
XMLTEXT
Same as
TEXT except the content is expected to be fully-formed XML that will get serialized as-is. |
Modifier and Type | Method and Description |
---|---|
boolean |
isOneOf(XmlFormat... formats)
Returns
|
static XmlFormat |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static XmlFormat[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final XmlFormat ATTR
Only applicable for bean properties, not bean classes.
Can only be applied to properties (methods/fields) of class types that can be convertible to Strings
.
public static final XmlFormat ATTRS
On a bean class, implies bean properties will be serialized as attributes instead of child elements by default.
On bean properties, implies that the bean property value itself should be serialized as attributes on the bean
element.
The bean property data type must be of class type Map<Object,Object>
where both
objects are convertible to Strings
.
public static final XmlFormat ELEMENT
Only applicable for bean properties, not bean classes.
Used to override the behavior of the ATTRS
format applied to the bean class.
public static final XmlFormat ELEMENTS
On a bean class, implies that bean properties will be serialized as child elements.
Note that this is equivalent to DEFAULT
.
Only applicable for objects of type array/Collection.
On a bean property, implies that the bean property value itself should be serialized as child elements of the bean element.
public static final XmlFormat MIXED
ELEMENTS
except primitive types (e.g. string/boolean/number/null) are not wrapped in elements.
Only applicable for bean properties, not bean classes.
Only applicable for objects of type array/Collection.
Use of this format may cause data type loss during parsing if the types cannot be inferred through reflection.
public static final XmlFormat MIXED_PWS
MIXED
, but whitespace in text nodes are not trimmed during parsing.
An example use is HTML5
public static final XmlFormat TEXT
Similar to MIXED
but value must be a single value, not a collection.
Only applicable for bean properties, not bean classes.
Use of this format may cause data type loss during parsing if the type cannot be inferred through reflection.
public static final XmlFormat TEXT_PWS
TEXT
, but whitespace in text node is not trimmed during parsing.public static final XmlFormat XMLTEXT
TEXT
except the content is expected to be fully-formed XML that will get serialized as-is.
During parsing, this XML text will be re-serialized and set on the property.
Only applicable for bean properties, not bean classes.
Use of this format may cause data type loss during parsing if the type cannot be inferred through reflection.
public static final XmlFormat COLLAPSED
Can only be applied to properties (methods/fields) of type collection or array, or collection classes.
public static final XmlFormat VOID
Only applicable for bean classes.
Identifies an element that never contains content.
The main difference in behavior is how non-void empty elements are handled in the HTML serializer.
Void elements are serialized as collapsed nodes (e.g.
public static XmlFormat[] values()
for (XmlFormat c : XmlFormat.values()) System.out.println(c);
public static XmlFormat valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2018 Apache. All rights reserved.