4
4
* Configuration object for the JSON parser. The configuration is immutable.
5
5
*/
6
6
public class JSONParserConfiguration extends ParserConfiguration {
7
-
8
- /** Original Configuration of the JSON Parser. */
9
- public static final JSONParserConfiguration ORIGINAL = new JSONParserConfiguration ();
10
-
11
- /** Original configuration of the JSON Parser except that values are kept as strings. */
12
- public static final JSONParserConfiguration KEEP_STRINGS = new JSONParserConfiguration ().withKeepStrings (true );
13
-
14
7
/**
15
8
* Used to indicate whether to overwrite duplicate key or not.
16
9
*/
17
10
private boolean overwriteDuplicateKey ;
18
11
19
- /**
20
- * This flag, when set to true, instructs the parser to throw a JSONException if it encounters an invalid character
21
- * immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the
22
- * JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
23
- */
24
- private boolean strictMode ;
25
-
26
12
/**
27
13
* Configuration with the default values.
28
14
*/
@@ -72,24 +58,6 @@ public JSONParserConfiguration withOverwriteDuplicateKey(final boolean overwrite
72
58
return clone ;
73
59
}
74
60
75
-
76
- /**
77
- * Sets the strict mode configuration for the JSON parser.
78
- * <p>
79
- * When strict mode is enabled, the parser will throw a JSONException if it encounters an invalid character
80
- * immediately following the final ']' character in the input. This is useful for ensuring strict adherence to the
81
- * JSON syntax, as any characters after the final closing bracket of a JSON array are considered invalid.
82
- *
83
- * @param mode a boolean value indicating whether strict mode should be enabled or not
84
- * @return a new JSONParserConfiguration instance with the updated strict mode setting
85
- */
86
- public JSONParserConfiguration withStrictMode (final boolean mode ) {
87
- JSONParserConfiguration clone = this .clone ();
88
- clone .strictMode = mode ;
89
-
90
- return clone ;
91
- }
92
-
93
61
/**
94
62
* The parser's behavior when meeting duplicate keys, controls whether the parser should
95
63
* overwrite duplicate keys or not.
@@ -99,18 +67,4 @@ public JSONParserConfiguration withStrictMode(final boolean mode) {
99
67
public boolean isOverwriteDuplicateKey () {
100
68
return this .overwriteDuplicateKey ;
101
69
}
102
-
103
-
104
- /**
105
- * Retrieves the current strict mode setting of the JSON parser.
106
- * <p>
107
- * Strict mode, when enabled, instructs the parser to throw a JSONException if it encounters an invalid character
108
- * immediately following the final ']' character in the input. This ensures strict adherence to the JSON syntax, as
109
- * any characters after the final closing bracket of a JSON array are considered invalid.
110
- *
111
- * @return the current strict mode setting. True if strict mode is enabled, false otherwise.
112
- */
113
- public boolean isStrictMode () {
114
- return this .strictMode ;
115
- }
116
70
}
0 commit comments