Skip to content

Commit 6bd858a

Browse files
committed
Reordering of features (alphabetic in section), minor javadoc tweaks
1 parent 3ec0246 commit 6bd858a

File tree

4 files changed

+145
-146
lines changed

4 files changed

+145
-146
lines changed

src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ public enum StreamReadFeature
3232

3333
// // // Validity checks
3434

35-
/**
36-
* Feature that determines whether {@link JsonParser} will explicitly
37-
* check that no duplicate JSON Object field names are encountered.
38-
* If enabled, parser will check all names within context and report
39-
* duplicates by throwing a {@link JsonParseException}; if disabled,
40-
* parser will not do such checking. Assumption in latter case is
41-
* that caller takes care of handling duplicates at a higher level:
42-
* data-binding, for example, has features to specify detection to
43-
* be done there.
44-
*<p>
45-
* Note that enabling this feature will incur performance overhead
46-
* due to having to store and check additional information: this typically
47-
* adds 20-30% to execution time for basic parsing.
48-
*/
49-
STRICT_DUPLICATE_DETECTION(JsonParser.Feature.STRICT_DUPLICATE_DETECTION),
50-
5135
/**
5236
* Feature that determines what to do if the underlying data format requires knowledge
5337
* of all properties to decode (usually via a Schema), and if no definition is
@@ -70,8 +54,35 @@ public enum StreamReadFeature
7054
*/
7155
IGNORE_UNDEFINED(JsonParser.Feature.IGNORE_UNDEFINED),
7256

57+
/**
58+
* Feature that determines whether {@link JsonParser} will explicitly
59+
* check that no duplicate JSON Object field names are encountered.
60+
* If enabled, parser will check all names within context and report
61+
* duplicates by throwing a {@link JsonParseException}; if disabled,
62+
* parser will not do such checking. Assumption in latter case is
63+
* that caller takes care of handling duplicates at a higher level:
64+
* data-binding, for example, has features to specify detection to
65+
* be done there.
66+
*<p>
67+
* Note that enabling this feature will incur performance overhead
68+
* due to having to store and check additional information: this typically
69+
* adds 20-30% to execution time for basic parsing.
70+
*/
71+
STRICT_DUPLICATE_DETECTION(JsonParser.Feature.STRICT_DUPLICATE_DETECTION),
72+
7373
// // // Other
7474

75+
/**
76+
* Feature that determines whether parser will clear "current token"
77+
* (accessible via JsonParser#currentToken()) when it is closed (via
78+
* {@link JsonParser#close()}).
79+
*<p>
80+
* Feature is enabled by default.
81+
*
82+
* @since 2.20
83+
*/
84+
CLEAR_CURRENT_TOKEN_ON_CLOSE(JsonParser.Feature.CLEAR_CURRENT_TOKEN_ON_CLOSE),
85+
7586
/**
7687
* Feature that determines whether {@link JsonLocation} instances should be constructed
7788
* with reference to source or not. If source reference is included, its type and contents
@@ -91,17 +102,6 @@ public enum StreamReadFeature
91102
*/
92103
INCLUDE_SOURCE_IN_LOCATION(JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION),
93104

94-
/**
95-
* Feature that determines whether we use the built-in {@link Double#parseDouble(String)} code to parse
96-
* doubles or if we use {@code FastDoubleParser}
97-
* instead.
98-
*<p>
99-
* This setting is disabled by default.
100-
*
101-
* @since 2.14
102-
*/
103-
USE_FAST_DOUBLE_PARSER(JsonParser.Feature.USE_FAST_DOUBLE_PARSER),
104-
105105
/**
106106
* Feature that determines whether to use the built-in Java code for parsing
107107
* <code>BigDecimal</code>s and <code>BigInteger</code>s or to use
@@ -114,16 +114,16 @@ public enum StreamReadFeature
114114
USE_FAST_BIG_NUMBER_PARSER(JsonParser.Feature.USE_FAST_BIG_NUMBER_PARSER),
115115

116116
/**
117-
* Feature that determines whether parser will clear "current token"
118-
* (accessible via JsonParser#currentToken()) when it is closed (via
119-
* {@link JsonParser#close()}).
117+
* Feature that determines whether we use the built-in {@link Double#parseDouble(String)} code to parse
118+
* doubles or if we use {@code FastDoubleParser}
119+
* instead.
120120
*<p>
121-
* Feature is enabled by default.
121+
* This setting is disabled by default.
122122
*
123-
* @since 2.20
123+
* @since 2.14
124124
*/
125-
CLEAR_CURRENT_TOKEN_ON_CLOSE(JsonParser.Feature.CLEAR_CURRENT_TOKEN_ON_CLOSE),
126-
125+
USE_FAST_DOUBLE_PARSER(JsonParser.Feature.USE_FAST_DOUBLE_PARSER),
126+
127127
;
128128

129129
/**
@@ -137,7 +137,7 @@ public enum StreamReadFeature
137137
* For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s;
138138
* if so, this is the feature to enable/disable.
139139
*/
140-
final private JsonParser.Feature _mappedFeature;
140+
private final JsonParser.Feature _mappedFeature;
141141

142142
private StreamReadFeature(JsonParser.Feature mapTo) {
143143
// only for 2.x, let's map everything to legacy feature:

src/main/java/com/fasterxml/jackson/core/StreamWriteFeature.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ public enum StreamWriteFeature
1717
{
1818
// // Low-level I/O / content features
1919

20+
/**
21+
* Feature that determines what happens when the generator is
22+
* closed while there are still unmatched
23+
* {@link JsonToken#START_ARRAY} or {@link JsonToken#START_OBJECT}
24+
* entries in output content. If enabled, such Array(s) and/or
25+
* Object(s) are automatically closed (that is, matching END_ token write
26+
* call is made for all open scopes); if disabled, no additional
27+
* write calls are made.
28+
*<p>
29+
* Feature is enabled by default.
30+
*/
31+
AUTO_CLOSE_CONTENT(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT),
32+
2033
/**
2134
* Feature that determines whether generator will automatically
2235
* close underlying output target that is NOT owned by the
@@ -32,19 +45,6 @@ public enum StreamWriteFeature
3245
*/
3346
AUTO_CLOSE_TARGET(JsonGenerator.Feature.AUTO_CLOSE_TARGET),
3447

35-
/**
36-
* Feature that determines what happens when the generator is
37-
* closed while there are still unmatched
38-
* {@link JsonToken#START_ARRAY} or {@link JsonToken#START_OBJECT}
39-
* entries in output content. If enabled, such Array(s) and/or
40-
* Object(s) are automatically closed (that is, matching END_ token write
41-
* call is made for all open scopes); if disabled, no additional
42-
* write calls are made.
43-
*<p>
44-
* Feature is enabled by default.
45-
*/
46-
AUTO_CLOSE_CONTENT(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT),
47-
4848
/**
4949
* Feature that specifies that calls to {@link JsonGenerator#flush} will cause
5050
* matching <code>flush()</code> to underlying {@link OutputStream}
@@ -76,21 +76,6 @@ public enum StreamWriteFeature
7676

7777
// // Schema/Validity support features
7878

79-
/**
80-
* Feature that determines whether {@link JsonGenerator} will explicitly
81-
* check that no duplicate JSON Object field names are written.
82-
* If enabled, generator will check all names within context and report
83-
* duplicates by throwing a {@link JsonGenerationException}; if disabled,
84-
* no such checking will be done. Assumption in latter case is
85-
* that caller takes care of not trying to write duplicate names.
86-
*<p>
87-
* Note that enabling this feature will incur performance overhead
88-
* due to having to store and check additional information.
89-
*<p>
90-
* Feature is disabled by default.
91-
*/
92-
STRICT_DUPLICATE_DETECTION(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION),
93-
9479
/**
9580
* Feature that determines what to do if the underlying data format requires knowledge
9681
* of all properties to output, and if no definition is found for a property that
@@ -111,6 +96,21 @@ public enum StreamWriteFeature
11196
*/
11297
IGNORE_UNKNOWN(JsonGenerator.Feature.IGNORE_UNKNOWN),
11398

99+
/**
100+
* Feature that determines whether {@link JsonGenerator} will explicitly
101+
* check that no duplicate JSON Object field names are written.
102+
* If enabled, generator will check all names within context and report
103+
* duplicates by throwing a {@link JsonGenerationException}; if disabled,
104+
* no such checking will be done. Assumption in latter case is
105+
* that caller takes care of not trying to write duplicate names.
106+
*<p>
107+
* Note that enabling this feature will incur performance overhead
108+
* due to having to store and check additional information.
109+
*<p>
110+
* Feature is disabled by default.
111+
*/
112+
STRICT_DUPLICATE_DETECTION(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION),
113+
114114
// // Misc other features
115115

116116
/**
@@ -144,7 +144,7 @@ public enum StreamWriteFeature
144144
* For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s;
145145
* if so, this is the feature to enable/disable.
146146
*/
147-
final private JsonGenerator.Feature _mappedFeature;
147+
private final JsonGenerator.Feature _mappedFeature;
148148

149149
private StreamWriteFeature(JsonGenerator.Feature mappedTo) {
150150
// only for 2.x, let's map everything to legacy feature:

src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,28 @@ public enum JsonReadFeature
4444
// // // Support for non-standard data format constructs: quoting/escaping
4545

4646
/**
47-
* Feature that determines whether parser will allow use
48-
* of single quotes (apostrophe, character '\'') for
49-
* quoting Strings (names and String values). If so,
50-
* this is in addition to other acceptable markers.
47+
* Feature that can be enabled to accept quoting of all character
48+
* using backslash quoting mechanism: if not enabled, only characters
49+
* that are explicitly listed by JSON specification can be thus
50+
* escaped (see JSON spec for small list of these characters)
5151
*<p>
52-
* Since JSON specification requires use of double quotes for
53-
* field names,
52+
* Since JSON specification requires quoting for all control characters,
5453
* this is a non-standard feature, and as such disabled by default.
5554
*/
56-
ALLOW_SINGLE_QUOTES(false, JsonParser.Feature.ALLOW_SINGLE_QUOTES),
55+
@SuppressWarnings("deprecation")
56+
ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER(false, JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER),
5757

5858
/**
5959
* Feature that determines whether parser will allow use
60-
* of unquoted field names (which is allowed by Javascript,
61-
* but not by JSON specification).
60+
* of single quotes (apostrophe, character '\'') for
61+
* quoting Strings (names and String values). If so,
62+
* this is in addition to other acceptable markers.
6263
*<p>
6364
* Since JSON specification requires use of double quotes for
6465
* field names,
6566
* this is a non-standard feature, and as such disabled by default.
6667
*/
67-
ALLOW_UNQUOTED_FIELD_NAMES(false, JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES),
68+
ALLOW_SINGLE_QUOTES(false, JsonParser.Feature.ALLOW_SINGLE_QUOTES),
6869

6970
/**
7071
* Feature that determines whether parser will allow
@@ -80,6 +81,17 @@ public enum JsonReadFeature
8081
@SuppressWarnings("deprecation")
8182
ALLOW_UNESCAPED_CONTROL_CHARS(false, JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS),
8283

84+
/**
85+
* Feature that determines whether parser will allow use
86+
* of unquoted field names (which is allowed by Javascript,
87+
* but not by JSON specification).
88+
*<p>
89+
* Since JSON specification requires use of double quotes for
90+
* field names,
91+
* this is a non-standard feature, and as such disabled by default.
92+
*/
93+
ALLOW_UNQUOTED_FIELD_NAMES(false, JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES),
94+
8395
/**
8496
* Feature that determines whether parser will allow
8597
* Record Separator (RS) control character ({@code 0x1E})
@@ -93,32 +105,21 @@ public enum JsonReadFeature
93105
@SuppressWarnings("deprecation")
94106
ALLOW_RS_CONTROL_CHAR(false, JsonParser.Feature.ALLOW_RS_CONTROL_CHAR),
95107

96-
/**
97-
* Feature that can be enabled to accept quoting of all character
98-
* using backslash quoting mechanism: if not enabled, only characters
99-
* that are explicitly listed by JSON specification can be thus
100-
* escaped (see JSON spec for small list of these characters)
101-
*<p>
102-
* Since JSON specification requires quoting for all control characters,
103-
* this is a non-standard feature, and as such disabled by default.
104-
*/
105-
@SuppressWarnings("deprecation")
106-
ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER(false, JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER),
107-
108108
// // // Support for non-standard data format constructs: number representations
109109

110110
/**
111111
* Feature that determines whether parser will allow
112-
* JSON integral numbers to start with additional (ignorable)
113-
* zeroes (like: 000001). If enabled, no exception is thrown, and extra
114-
* nulls are silently ignored (and not included in textual representation
115-
* exposed via {@link JsonParser#getText}).
112+
* JSON decimal numbers to start with a decimal point
113+
* (like: .123). If enabled, no exception is thrown, and the number
114+
* is parsed as though a leading 0 had been present.
116115
*<p>
117-
* Since JSON specification does not allow leading zeroes,
116+
* Since JSON specification does not allow leading decimal points,
118117
* this is a non-standard feature, and as such disabled by default.
118+
*
119+
* @since 2.11
119120
*/
120121
@SuppressWarnings("deprecation")
121-
ALLOW_LEADING_ZEROS_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS),
122+
ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS),
122123

123124
/**
124125
* Feature that determines whether parser will allow
@@ -134,34 +135,18 @@ public enum JsonReadFeature
134135
@SuppressWarnings("deprecation")
135136
ALLOW_LEADING_PLUS_SIGN_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_LEADING_PLUS_SIGN_FOR_NUMBERS),
136137

137-
138138
/**
139139
* Feature that determines whether parser will allow
140-
* JSON decimal numbers to start with a decimal point
141-
* (like: .123). If enabled, no exception is thrown, and the number
142-
* is parsed as though a leading 0 had been present.
143-
*<p>
144-
* Since JSON specification does not allow leading decimal points,
145-
* this is a non-standard feature, and as such disabled by default.
146-
*
147-
* @since 2.11
148-
*/
149-
@SuppressWarnings("deprecation")
150-
ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS),
151-
152-
/**
153-
* Feature that determines whether parser will allow
154-
* JSON decimal numbers to end with a decimal point
155-
* (like: 123.). If enabled, no exception is thrown, and the number
156-
* is parsed as though the trailing decimal point had not been present.
140+
* JSON integral numbers to start with additional (ignorable)
141+
* zeroes (like: 000001). If enabled, no exception is thrown, and extra
142+
* nulls are silently ignored (and not included in textual representation
143+
* exposed via {@link JsonParser#getText}).
157144
*<p>
158-
* Since JSON specification does not allow trailing decimal points,
145+
* Since JSON specification does not allow leading zeroes,
159146
* this is a non-standard feature, and as such disabled by default.
160-
*
161-
* @since 2.14
162147
*/
163148
@SuppressWarnings("deprecation")
164-
ALLOW_TRAILING_DECIMAL_POINT_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_TRAILING_DECIMAL_POINT_FOR_NUMBERS),
149+
ALLOW_LEADING_ZEROS_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS),
165150

166151
/**
167152
* Feature that allows parser to recognize set of
@@ -184,6 +169,20 @@ public enum JsonReadFeature
184169
@SuppressWarnings("deprecation")
185170
ALLOW_NON_NUMERIC_NUMBERS(false, JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS),
186171

172+
/**
173+
* Feature that determines whether parser will allow
174+
* JSON decimal numbers to end with a decimal point
175+
* (like: 123.). If enabled, no exception is thrown, and the number
176+
* is parsed as though the trailing decimal point had not been present.
177+
*<p>
178+
* Since JSON specification does not allow trailing decimal points,
179+
* this is a non-standard feature, and as such disabled by default.
180+
*
181+
* @since 2.14
182+
*/
183+
@SuppressWarnings("deprecation")
184+
ALLOW_TRAILING_DECIMAL_POINT_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_TRAILING_DECIMAL_POINT_FOR_NUMBERS),
185+
187186
// // // Support for non-standard data format constructs: array/value separators
188187

189188
/**
@@ -226,14 +225,14 @@ public enum JsonReadFeature
226225
ALLOW_TRAILING_COMMA(false, JsonParser.Feature.ALLOW_TRAILING_COMMA),
227226
;
228227

229-
final private boolean _defaultState;
230-
final private int _mask;
228+
private final boolean _defaultState;
229+
private final int _mask;
231230

232231
/**
233232
* For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s;
234233
* if so, this is the feature to enable/disable.
235234
*/
236-
final private JsonParser.Feature _mappedFeature;
235+
private final JsonParser.Feature _mappedFeature;
237236

238237
/**
239238
* Method that calculates bit set (flags) of all features that

0 commit comments

Comments
 (0)