@@ -10,9 +10,9 @@ public class JSONParserConfiguration extends ParserConfiguration {
1010 private boolean overwriteDuplicateKey ;
1111
1212 /**
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 .
1414 */
15- private boolean javaNullAsJsonNull ;
15+ private boolean useNativeNulls ;
1616
1717 /**
1818 * Configuration with the default values.
@@ -74,16 +74,16 @@ public JSONParserConfiguration withOverwriteDuplicateKey(final boolean overwrite
7474 }
7575
7676 /**
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 .
8080 *
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
8282 * @return The existing configuration will not be modified. A new configuration is returned.
8383 */
84- public JSONParserConfiguration withJavaNullAsJsonNull (final boolean javaNullAsJsonNull ) {
84+ public JSONParserConfiguration withUseNativeNulls (final boolean useNativeNulls ) {
8585 JSONParserConfiguration clone = this .clone ();
86- clone .javaNullAsJsonNull = javaNullAsJsonNull ;
86+ clone .useNativeNulls = useNativeNulls ;
8787
8888 return clone ;
8989 }
@@ -128,13 +128,14 @@ public boolean isOverwriteDuplicateKey() {
128128 }
129129
130130 /**
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>).
133134 *
134- * @return The <code>javaNullAsJsonNull </code> configuration value.
135+ * @return The <code>useNativeNulls </code> configuration value.
135136 */
136- public boolean isJavaNullAsJsonNull () {
137- return this .javaNullAsJsonNull ;
137+ public boolean isUseNativeNulls () {
138+ return this .useNativeNulls ;
138139 }
139140
140141
0 commit comments