Skip to content

Commit de592b1

Browse files
committed
yet more tweaking
1 parent f1a6005 commit de592b1

1 file changed

Lines changed: 54 additions & 54 deletions

File tree

src/main/java/tools/jackson/dataformat/xml/XmlWriteFeature.java

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,59 @@
1111
*/
1212
public enum XmlWriteFeature implements FormatFeature
1313
{
14+
/**
15+
* Feature that enables automatic conversion of logical property
16+
* name {@code "xsi:type"} into matching XML name where "type"
17+
* is the local name and "xsi" prefix is bound to URI
18+
* {@link XMLConstants#W3C_XML_SCHEMA_INSTANCE_NS_URI},
19+
* and output is indicated to be done as XML Attribute.
20+
* This is mostly desirable for Polymorphic handling where it is difficult
21+
* to specify XML Namespace for type identifier
22+
*<p>
23+
* Default setting is {@code true} (enabled) in Jackson 3.0:
24+
* it was {@code false} (disabled)in Jackson 2.x.
25+
*/
26+
AUTO_DETECT_XSI_TYPE(true),
27+
28+
/**
29+
* Feature that determines whether attempt to serialize a directly nested
30+
* array or {@link java.util.Collection} (i.e. an
31+
* array/Collection whose immediate parent is also an array/Collection
32+
* — without an intermediate POJO) should fail with an exception (true)
33+
* or be allowed (false) — knowing that, when allowed, the resulting XML
34+
* cannot represent the nested structure and the inner dimension will be
35+
* silently flattened into the outer one, nor can it be deserialized back.
36+
*<p>
37+
* "Natural-style" XML has no canonical representation for an unnamed
38+
* nested array, so a clean round-trip is not possible without an
39+
* intermediate POJO wrapper.
40+
*<p>
41+
* Default setting is {@code true} (enabled): nested arrays cause an
42+
* exception. Disabling restores the legacy behavior of
43+
* silently flattening dimensions.
44+
*<p>
45+
* See <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/556">#556</a>.
46+
*
47+
* @since 3.2
48+
*/
49+
FAIL_ON_NESTED_ARRAYS(true),
50+
51+
/**
52+
* Feature that determines writing of root values of type {@code ObjectNode}
53+
* ({@code JsonNode} subtype that represents Object content values),
54+
* regarding XML output.
55+
* If enabled and {@code ObjectNode} has exactly one entry (key/value pair),
56+
* then key of that entry is used as the root element name (and value
57+
* is written as contents. Otherwise (if feature disabled, or if root
58+
* {@code ObjectNode} has any other number of key/value entries,
59+
* root element name is determined using normal logic (either explicitly
60+
* configured, or {@code ObjectNode} otherwise).
61+
*<p>
62+
* Default setting is {@code true} (enabled) in Jackson 3.x:
63+
* it was {@code false} (disabled)in Jackson 2.x.
64+
*/
65+
UNWRAP_ROOT_OBJECT_NODE(true),
66+
1467
/**
1568
* Feature that controls whether XML declaration should be written before
1669
* when generator is initialized (true) or not (false)
@@ -48,36 +101,6 @@ public enum XmlWriteFeature implements FormatFeature
48101
*/
49102
WRITE_NULLS_AS_XSI_NIL(true),
50103

51-
/**
52-
* Feature that determines writing of root values of type {@code ObjectNode}
53-
* ({@code JsonNode} subtype that represents Object content values),
54-
* regarding XML output.
55-
* If enabled and {@code ObjectNode} has exactly one entry (key/value pair),
56-
* then key of that entry is used as the root element name (and value
57-
* is written as contents. Otherwise (if feature disabled, or if root
58-
* {@code ObjectNode} has any other number of key/value entries,
59-
* root element name is determined using normal logic (either explicitly
60-
* configured, or {@code ObjectNode} otherwise).
61-
*<p>
62-
* Default setting is {@code true} (enabled) in Jackson 3.x:
63-
* it was {@code false} (disabled)in Jackson 2.x.
64-
*/
65-
UNWRAP_ROOT_OBJECT_NODE(true),
66-
67-
/**
68-
* Feature that enables automatic conversion of logical property
69-
* name {@code "xsi:type"} into matching XML name where "type"
70-
* is the local name and "xsi" prefix is bound to URI
71-
* {@link XMLConstants#W3C_XML_SCHEMA_INSTANCE_NS_URI},
72-
* and output is indicated to be done as XML Attribute.
73-
* This is mostly desirable for Polymorphic handling where it is difficult
74-
* to specify XML Namespace for type identifier
75-
*<p>
76-
* Default setting is {@code true} (enabled) in Jackson 3.0:
77-
* it was {@code false} (disabled)in Jackson 2.x.
78-
*/
79-
AUTO_DETECT_XSI_TYPE(true),
80-
81104
/**
82105
* Feature that determines how floating-point infinity values are
83106
* serialized.
@@ -104,32 +127,9 @@ public enum XmlWriteFeature implements FormatFeature
104127
* {@link tools.jackson.dataformat.xml.XmlReadFeature}.
105128
*<p>
106129
* Default setting is {@code true} (enabled) in Jackson 3.0:
107-
* it was {@code false} (disabled)in Jackson 2.x.
130+
* it was {@code false} (disabled) in Jackson 2.x.
108131
*/
109132
WRITE_XML_SCHEMA_CONFORMING_FLOATS(true),
110-
111-
/**
112-
* Feature that determines whether attempt to serialize a directly nested
113-
* array or {@link java.util.Collection} (i.e. an
114-
* array/Collection whose immediate parent is also an array/Collection
115-
* — without an intermediate POJO) should fail with an exception (true)
116-
* or be allowed (false) — knowing that, when allowed, the resulting XML
117-
* cannot represent the nested structure and the inner dimension will be
118-
* silently flattened into the outer one, nor can it be deserialized back.
119-
*<p>
120-
* "Natural-style" XML has no canonical representation for an unnamed
121-
* nested array, so a clean round-trip is not possible without an
122-
* intermediate POJO wrapper.
123-
*<p>
124-
* Default setting is {@code true} (enabled): nested arrays cause an
125-
* exception. Disabling restores the legacy behavior of
126-
* silently flattening dimensions.
127-
*<p>
128-
* See <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/556">#556</a>.
129-
*
130-
* @since 3.2
131-
*/
132-
FAIL_ON_NESTED_ARRAYS(true),
133133
;
134134

135135
private final boolean _defaultState;

0 commit comments

Comments
 (0)