Package com.unboundid.util.json
Class JSONNull
java.lang.Object
com.unboundid.util.json.JSONValue
com.unboundid.util.json.JSONNull
- All Implemented Interfaces:
Serializable,Comparable<JSONValue>
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class JSONNull
extends JSONValue
This class provides an implementation of a JSON value that represents a null
value. The string representation of the null value is
null in all
lowercase and without any quotation marks.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendToJSONBuffer(JSONBuffer buffer) Appends this value to the provided JSON buffer.voidappendToJSONBuffer(String fieldName, JSONBuffer buffer) Appends a field with the given name and this value to the provided JSON buffer.booleanIndicates whether this JSON value is considered equal to the provided JSON value, subject to the specified constraints.booleanIndicates whether the provided object is equal to this JSON value.inthashCode()Retrieves a hash code for this JSON value.Retrieves a normalized string representation of this null value as it should appear in a JSON object.toNormalizedString(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Retrieves a normalized string representation of this null value as it should appear in a JSON object.voidtoNormalizedString(StringBuilder buffer) Appends a normalized string representation of this null value as it should appear in a JSON object to the provided buffer.voidtoNormalizedString(StringBuilder buffer, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Appends a normalized string representation of this null value as it should appear in a JSON object to the provided buffer.toNormalizedValue(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Retrieves a normalized representation of this value using the provided settings.Retrieves a single-line string representation of this null value as it should appear in a JSON object.voidtoSingleLineString(StringBuilder buffer) Appends a single-line string representation of this null value as it should appear in a JSON object to the provided buffer.toString()Retrieves a string representation of this null value as it should appear in a JSON object.voidtoString(StringBuilder buffer) Appends a string representation of this null value as it should appear in a JSON object to the provided buffer.
-
Field Details
-
NULL
A pre-allocated JSON null value object.
-
-
Constructor Details
-
JSONNull
public JSONNull()Creates a new JSON value capable of representing anullvalue.
-
-
Method Details
-
hashCode
Retrieves a hash code for this JSON value. -
equals
Indicates whether the provided object is equal to this JSON value. -
equals
public boolean equals(@NotNull JSONValue v, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Indicates whether this JSON value is considered equal to the provided JSON value, subject to the specified constraints. Note that not all constraints will apply to all data types.- Specified by:
equalsin classJSONValue- Parameters:
v- The JSON value for which to make the determination. It must not benull.ignoreFieldNameCase- Indicates whether to ignore differences in the capitalization of JSON field names.ignoreValueCase- Indicates whether to ignore differences in the capitalization of JSON values that represent strings.ignoreArrayOrder- Indicates whether to ignore differences in the order of elements in JSON arrays.- Returns:
trueif this JSON value is considered equal to the provided JSON value (subject to the specified constraints), orfalseif not.
-
toString
Retrieves a string representation of this null value as it should appear in a JSON object. Null values will always have a string representation of "null" (without the surrounding quotes). -
toString
Appends a string representation of this null value as it should appear in a JSON object to the provided buffer. Null values will always have a string representation of "null" (without the surrounding quotes). -
toSingleLineString
Retrieves a single-line string representation of this null value as it should appear in a JSON object. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toSingleLineStringin classJSONValue- Returns:
- A single-line string representation of this null value as it should appear in a JSON object.
-
toSingleLineString
Appends a single-line string representation of this null value as it should appear in a JSON object to the provided buffer. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toSingleLineStringin classJSONValue- Parameters:
buffer- The buffer to which the information should be appended.
-
toNormalizedString
Retrieves a normalized string representation of this null value as it should appear in a JSON object. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toNormalizedStringin classJSONValue- Returns:
- A normalized string representation of this null value as it should appear in a JSON object.
-
toNormalizedString
Appends a normalized string representation of this null value as it should appear in a JSON object to the provided buffer. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toNormalizedStringin classJSONValue- Parameters:
buffer- The buffer to which the information should be appended.
-
toNormalizedString
@NotNull public String toNormalizedString(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Retrieves a normalized string representation of this null value as it should appear in a JSON object. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toNormalizedStringin classJSONValue- Parameters:
ignoreFieldNameCase- Indicates whether field names should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreValueCase- Indicates whether string field values should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreArrayOrder- Indicates whether the order of elements in an array should be considered significant (iffalse) or insignificant (iftrue).- Returns:
- A normalized string representation of this null value as it should appear in a JSON object.
-
toNormalizedString
public void toNormalizedString(@NotNull StringBuilder buffer, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Appends a normalized string representation of this null value as it should appear in a JSON object to the provided buffer. Null values will always have a string representation of "null" (without the surrounding quotes).- Specified by:
toNormalizedStringin classJSONValue- Parameters:
buffer- The buffer to which the information should be appended.ignoreFieldNameCase- Indicates whether field names should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreValueCase- Indicates whether string field values should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreArrayOrder- Indicates whether the order of elements in an array should be considered significant (iffalse) or insignificant (iftrue).
-
toNormalizedValue
@NotNull public JSONNull toNormalizedValue(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder) Retrieves a normalized representation of this value using the provided settings.- Specified by:
toNormalizedValuein classJSONValue- Parameters:
ignoreFieldNameCase- Indicates whether field names should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreValueCase- Indicates whether string field values should be treated in a case-sensitive (iffalse) or case-insensitive (iftrue) manner.ignoreArrayOrder- Indicates whether the order of elements in an array should be considered significant (iffalse) or insignificant (iftrue).- Returns:
- A normalized representation of this value using the provided settings.
-
appendToJSONBuffer
Appends this value to the provided JSON buffer. This will not include a field name, so it should only be used for Boolean value elements in an array.- Specified by:
appendToJSONBufferin classJSONValue- Parameters:
buffer- The JSON buffer to which this value should be appended.
-
appendToJSONBuffer
Appends a field with the given name and this value to the provided JSON buffer.- Specified by:
appendToJSONBufferin classJSONValue- Parameters:
fieldName- The name to use for the field.buffer- The JSON buffer to which this value should be appended.
-