Class JSONNull

java.lang.Object
com.unboundid.util.json.JSONValue
com.unboundid.util.json.JSONNull
All Implemented Interfaces:
Serializable, Comparable<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
    Modifier and Type
    Field
    Description
    static final JSONNull
    A pre-allocated JSON null value object.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new JSON value capable of representing a null value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends this value to the provided JSON buffer.
    void
    appendToJSONBuffer(String fieldName, JSONBuffer buffer)
    Appends a field with the given name and this value to the provided JSON buffer.
    boolean
    equals(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.
    boolean
    Indicates whether the provided object is equal to this JSON value.
    int
    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.
    void
    Appends a normalized string representation of this null value as it should appear in a JSON object to the provided buffer.
    void
    toNormalizedString(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.
    void
    Appends a single-line string representation of this null value as it should appear in a JSON object to the provided buffer.
    Retrieves a string representation of this null value as it should appear in a JSON object.
    void
    Appends a string representation of this null value as it should appear in a JSON object to the provided buffer.

    Methods inherited from class com.unboundid.util.json.JSONValue

    compareTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • JSONNull

      public JSONNull()
      Creates a new JSON value capable of representing a null value.
  • Method Details

    • hashCode

      public int hashCode()
      Retrieves a hash code for this JSON value.
      Specified by:
      hashCode in class JSONValue
      Returns:
      The hash code for this JSON value.
    • equals

      public boolean equals(@Nullable Object o)
      Indicates whether the provided object is equal to this JSON value.
      Specified by:
      equals in class JSONValue
      Parameters:
      o - The object to compare against this JSON value.
      Returns:
      true if the provided object is considered equal to this JSON value, or false if not.
    • 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:
      equals in class JSONValue
      Parameters:
      v - The JSON value for which to make the determination. It must not be null.
      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:
      true if this JSON value is considered equal to the provided JSON value (subject to the specified constraints), or false if 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).
      Specified by:
      toString in class JSONValue
      Returns:
      A string representation of this null value as it should appear in a JSON object.
    • toString

      public void toString(@NotNull StringBuilder buffer)
      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).
      Specified by:
      toString in class JSONValue
      Parameters:
      buffer - The buffer to which the information should be appended.
    • 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:
      toSingleLineString in class JSONValue
      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:
      toSingleLineString in class JSONValue
      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:
      toNormalizedString in class JSONValue
      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:
      toNormalizedString in class JSONValue
      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:
      toNormalizedString in class JSONValue
      Parameters:
      ignoreFieldNameCase - Indicates whether field names should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreValueCase - Indicates whether string field values should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreArrayOrder - Indicates whether the order of elements in an array should be considered significant (if false) or insignificant (if true).
      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:
      toNormalizedString in class JSONValue
      Parameters:
      buffer - The buffer to which the information should be appended.
      ignoreFieldNameCase - Indicates whether field names should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreValueCase - Indicates whether string field values should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreArrayOrder - Indicates whether the order of elements in an array should be considered significant (if false) or insignificant (if true).
    • toNormalizedValue

      @NotNull public JSONNull toNormalizedValue(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
      Retrieves a normalized representation of this value using the provided settings.
      Specified by:
      toNormalizedValue in class JSONValue
      Parameters:
      ignoreFieldNameCase - Indicates whether field names should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreValueCase - Indicates whether string field values should be treated in a case-sensitive (if false) or case-insensitive (if true) manner.
      ignoreArrayOrder - Indicates whether the order of elements in an array should be considered significant (if false) or insignificant (if true).
      Returns:
      A normalized representation of this value using the provided settings.
    • appendToJSONBuffer

      public void appendToJSONBuffer(@NotNull JSONBuffer buffer)
      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:
      appendToJSONBuffer in class JSONValue
      Parameters:
      buffer - The JSON buffer to which this value should be appended.
    • appendToJSONBuffer

      public void appendToJSONBuffer(@NotNull String fieldName, @NotNull JSONBuffer buffer)
      Appends a field with the given name and this value to the provided JSON buffer.
      Specified by:
      appendToJSONBuffer in class JSONValue
      Parameters:
      fieldName - The name to use for the field.
      buffer - The JSON buffer to which this value should be appended.