@@ -10,9 +10,9 @@ public class JSONParserConfiguration extends ParserConfiguration {
10
10
private boolean overwriteDuplicateKey ;
11
11
12
12
/**
13
- * Used to indicate whether ignore null values when converting java maps to JSONObject or not .
13
+ * Used to indicate whether to convert java null values to JSONObject.NULL or ignoring the entry when converting java maps .
14
14
*/
15
- private boolean javaNullAsJsonNull ;
15
+ private boolean useNativeNulls ;
16
16
17
17
/**
18
18
* Configuration with the default values.
@@ -74,16 +74,16 @@ public JSONParserConfiguration withOverwriteDuplicateKey(final boolean overwrite
74
74
}
75
75
76
76
/**
77
- * Controls the parser's behavior when meeting duplicate keys .
78
- * If set to false , the parser will throw a JSONException when meeting a duplicate key .
79
- * Or the duplicate key's value will be overwritten .
77
+ * Controls the parser's behavior when meeting Java null values while converting maps .
78
+ * If set to true , the parser will put a JSONObject.NULL into the resulting JSONObject .
79
+ * Or the map entry will be ignored .
80
80
*
81
- * @param javaNullAsJsonNull define, if the parser should ignore null values in Java maps
81
+ * @param useNativeNulls defines if the parser should convert null values in Java maps
82
82
* @return The existing configuration will not be modified. A new configuration is returned.
83
83
*/
84
- public JSONParserConfiguration withJavaNullAsJsonNull (final boolean javaNullAsJsonNull ) {
84
+ public JSONParserConfiguration withUseNativeNulls (final boolean useNativeNulls ) {
85
85
JSONParserConfiguration clone = this .clone ();
86
- clone .javaNullAsJsonNull = javaNullAsJsonNull ;
86
+ clone .useNativeNulls = useNativeNulls ;
87
87
88
88
return clone ;
89
89
}
@@ -128,13 +128,14 @@ public boolean isOverwriteDuplicateKey() {
128
128
}
129
129
130
130
/**
131
- * The parser's behavior when meeting a null value in a java map, controls whether the parser should ignore
132
- * that map entry or write a JSON entry with a null value.
131
+ * The parser's behavior when meeting a null value in a java map, controls whether the parser should
132
+ * write a JSON entry with a null value (<code>isUseNativeNulls() == true</code>)
133
+ * or ignore that map entry (<code>isUseNativeNulls() == false</code>).
133
134
*
134
- * @return The <code>javaNullAsJsonNull </code> configuration value.
135
+ * @return The <code>useNativeNulls </code> configuration value.
135
136
*/
136
- public boolean isJavaNullAsJsonNull () {
137
- return this .javaNullAsJsonNull ;
137
+ public boolean isUseNativeNulls () {
138
+ return this .useNativeNulls ;
138
139
}
139
140
140
141
0 commit comments