Module jakarta.json
Package jakarta.json

Class JsonValueImpl

java.lang.Object
jakarta.json.JsonValueImpl
All Implemented Interfaces:
JsonValue, Serializable

final class JsonValueImpl extends Object implements JsonValue, Serializable
Private implementation of JsonValue for simple JsonValue.ValueTypes allowing their usage in constants which are better to implement Serializable.
  • Field Details

  • Constructor Details

    • JsonValueImpl

      JsonValueImpl(JsonValue.ValueType valueType)
      Default constructor.
      Parameters:
      valueType - Type of this JsonValue
  • Method Details

    • getValueType

      public JsonValue.ValueType getValueType()
      Returns the value type of this JSON value.
      Specified by:
      getValueType in interface JsonValue
      Returns:
      JSON value type
    • equals

      public boolean equals(Object obj)
      Compares the specified object with this JsonValue object for equality. Returns true if and only if the specified object is also a JsonValue, and their getValueType() objects are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to be compared for equality with this JsonValue
      Returns:
      true if the specified object is equal to this JsonValue
    • hashCode

      public int hashCode()
      Returns the hash code value for this JsonValue object. The hash code of the JsonValue object is defined to be its getValueType() object's hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this JsonValue object
    • toString

      public String toString()
      Description copied from interface: JsonValue
      Returns JSON text for this JSON value.
      Specified by:
      toString in interface JsonValue
      Overrides:
      toString in class Object
      Returns:
      JSON text