public enum Bean2XmlOptions extends Enum<Bean2XmlOptions>
Bean2XmlConverter
to control the structure of the
generated DOM tree.Enum Constant and Description |
---|
BYTE_ARRAYS_AS_BASE64
Outputs byte arrays as a Base64-encoded string
|
BYTE_ARRAYS_AS_HEX
Outputs byte arrays as a hex-encoded string
|
CACHE_INTROSPECTIONS
Will use a shared static introspection cache for all conversions.
|
DEFER_EXCEPTIONS
Defer exception processing.
|
ENUM_AS_NAME_AND_VALUE
Output enum instances with an attribute containing the enum's name, and
the text value containing the enum's
toString() . |
MAP_KEYS_AS_ELEMENT_NAME
Output maps in an "introspected" format, where the name of each item
is the map key (rather than "data"), and the "key" attribute is omitted.
|
NULL_AS_EMPTY
If the value is
null , add an element containing a single
text child holding an empty string. |
NULL_AS_XSI_NIL
If the value is
null , add an element without content, with
the attribute xsi:nil set to "true". |
SEQUENCE_AS_REPEATED_ELEMENTS
Will create sequences (arrays, lists, and sets) as repeated elements
rather than a parent-children construct.
|
SEQUENCE_NAMED_BY_PARENT
Sequences (arrays, lists, sets) will name their elements according to
the parent element, with any trailing "s" removed.
|
SET_ACCESSIBLE
When introspecting, call
setAccessible(true) on accessor
methods. |
SKIP_CIRCULAR_REFERENCES
Omits circular references from the output.
|
USE_INDEX_ATTR
Will add an
index attribute to the child elements of
sequences (arrays, lists, sets); the value of this attribute is the
element's position in the sequence (numbered from 0). |
USE_TYPE_ATTR
Will add a
type attribute to each element; see package
docs for more details. |
XSD_FORMAT
Outputs values using formats defined by XML Schema, rather than Java's
String.valueOf() method. |
Modifier and Type | Method and Description |
---|---|
static Bean2XmlOptions |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Bean2XmlOptions[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Bean2XmlOptions BYTE_ARRAYS_AS_BASE64
public static final Bean2XmlOptions BYTE_ARRAYS_AS_HEX
public static final Bean2XmlOptions CACHE_INTROSPECTIONS
Warning: if you use this option, do not store this library in a shared app-server classpath. If you do, the cache will prevent class unloading, and you will run out of permgen space.
public static final Bean2XmlOptions DEFER_EXCEPTIONS
Note: all deferred exceptions will be of type
ConversionException
, and will wrap
an underlying cause. Because the converter works by reflection, in many
cases this cause will be an InvocationTargetException
with
its own cause.
public static final Bean2XmlOptions ENUM_AS_NAME_AND_VALUE
toString()
. Default is
to output the enum's name as the element value.
This option is useful when the enum contains descriptive text, and you want to use that text in further output.
public static final Bean2XmlOptions MAP_KEYS_AS_ELEMENT_NAME
public static final Bean2XmlOptions NULL_AS_EMPTY
null
, add an element containing a single
text child holding an empty string.
This may make life easier when processing data from a certain DBMS designed in the mid-1980s when disk space was too expensive to create a separate null flag for VARCHAR fields. However, be aware that it may cause parsing problems.
public static final Bean2XmlOptions NULL_AS_XSI_NIL
null
, add an element without content, with
the attribute xsi:nil
set to "true".public static final Bean2XmlOptions SEQUENCE_AS_REPEATED_ELEMENTS
Xml2BeanConverter
.public static final Bean2XmlOptions SET_ACCESSIBLE
setAccessible(true)
on accessor
methods. This allows use with instances of private classes that have
public methods, but will cause an exception in any environment that has
a security manager that denies this operation.public static final Bean2XmlOptions SKIP_CIRCULAR_REFERENCES
public static final Bean2XmlOptions SEQUENCE_NAMED_BY_PARENT
public static final Bean2XmlOptions USE_INDEX_ATTR
index
attribute to the child elements of
sequences (arrays, lists, sets); the value of this attribute is the
element's position in the sequence (numbered from 0). This index is
not terribly useful, so is no longer default behavior.public static final Bean2XmlOptions USE_TYPE_ATTR
type
attribute to each element; see package
docs for more details.
This option implies XSD_FORMAT
.
public static final Bean2XmlOptions XSD_FORMAT
String.valueOf()
method. Note that these formats are not
flagged in the element, so sender and receiver will have to agree on
the format.public static Bean2XmlOptions[] values()
for (Bean2XmlOptions c : Bean2XmlOptions.values()) System.out.println(c);
public static Bean2XmlOptions 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 null