Home | History | Annotate | Download | only in json

Lines Matching defs:NULL

30  * A modifiable set of name/value mappings. Names are unique, non-null strings.
32 * JSONArrays}, Strings, Booleans, Integers, Longs, Doubles or {@link #NULL}.
33 * Values may not be {@code null}, {@link Double#isNaN() NaNs}, {@link
53 * <li>When the requested type is a String, other non-null values will be
54 * coerced using {@link String#valueOf(Object)}. Although null cannot be
55 * coerced, the sentinel value {@link JSONObject#NULL} is coerced to the
56 * string "null".
69 * <p><strong>Warning:</strong> this class represents null in two incompatible
70 * ways: the standard Java {@code null} reference, and the sentinel value {@link
71 * JSONObject#NULL}. In particular, calling {@code put(name, null)} removes the
72 * named entry from the object but {@code put(name, JSONObject.NULL)} stores an
73 * entry whose value is {@code JSONObject.NULL}.
87 * {@code null}, names with this value:
97 * returning true when compared to {@code null}. Its {@link #toString}
98 * method returns "null".
100 public static final Object NULL = new Object() {
102 return o == this || o == null; // API specifies this broken equals implementation
104 // at least make the broken equals(null) consistent with Objects.hashCode(null).
105 @Override public int hashCode() { return Objects.hashCode(null); }
107 return "null";
126 * @throws NullPointerException if any of the map's keys are null.
134 * Deviate from the original by checking that keys are non-null and
138 if (key == null) {
139 throw new NullPointerException("key == null");
188 if (value != null) {
249 * mapping with the same name. If the value is {@code null}, any existing
253 * Integer, Long, Double, {@link #NULL}, or {@code null}. May not be
259 if (value == null) {
272 * Equivalent to {@code put(name, value)} when both parameters are non-null;
276 if (name == null || value == null) {
297 * Integer, Long, Double, {@link #NULL} or null. May not be {@link
304 if (current == null) {
326 * @throws JSONException if {@code name} is {@code null} or if the mapping for
327 * {@code name} is non-null and is not a {@link JSONArray}.
337 } else if (current == null) {
351 if (name == null) {
352 throw new JSONException("Names must be non-null");
360 * @return the value previously mapped by {@code name}, or null if there was
369 * a mapping whose value is {@link #NULL}.
373 return value == null || value == NULL;
378 * may be {@link #NULL}.
391 if (result == null) {
398 * Returns the value mapped by {@code name}, or null if no such mapping
415 if (result == null) {
436 return result != null ? result : fallback;
449 if (result == null) {
470 return result != null ? result : fallback;
483 if (result == null) {
504 return result != null ? result : fallback;
519 if (result == null) {
543 return result != null ? result : fallback;
555 if (result == null) {
576 return result != null ? result : fallback;
597 * JSONArray}, or null otherwise.
601 return object instanceof JSONArray ? (JSONArray) object : null;
622 * JSONObject}, or null otherwise.
626 return object instanceof JSONObject ? (JSONObject) object : null;
631 * array contains null for names that aren't mapped. This method returns
632 * null if {@code names} is either null or empty.
636 if (names == null) {
637 return null;
641 return null;
677 * returns null if this object contains no mappings.
681 ? null
695 return null;
735 if (number == null) {
736 throw new JSONException("Number must be non-null");
759 * @param data the string to encode. Null will be interpreted as an empty
763 if (data == null) {
768 stringer.open(JSONStringer.Scope.NULL, "");
770 stringer.close(JSONStringer.Scope.NULL, JSONStringer.Scope.NULL, "");
780 * <p>If the object is null or , returns {@link #NULL}.
782 * If the object is {@code NULL}, no wrapping is necessary.
787 * If wrapping fails, returns null.
790 if (o == null) {
791 return NULL;
796 if (o.equals(NULL)) {
824 return null;