- java.lang.Object
-
- jakarta.json.JsonValueImpl
-
- All Implemented Interfaces:
JsonValue
,java.io.Serializable
final class JsonValueImpl extends java.lang.Object implements JsonValue, java.io.Serializable
Private implementation ofJsonValue
for simpleJsonValue.ValueType
s allowing their usage in constants which are better to implementSerializable
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jakarta.json.JsonValue
JsonValue.ValueType
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
for serializationprivate JsonValue.ValueType
valueType
Type of this JsonValue.-
Fields inherited from interface jakarta.json.JsonValue
EMPTY_JSON_ARRAY, EMPTY_JSON_OBJECT, FALSE, NULL, TRUE
-
-
Constructor Summary
Constructors Constructor Description JsonValueImpl(JsonValue.ValueType valueType)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Compares the specified object with thisJsonValue
object for equality.JsonValue.ValueType
getValueType()
Returns the value type of this JSON value.int
hashCode()
Returns the hash code value for thisJsonValue
object.java.lang.String
toString()
Returns JSON text for this JSON value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jakarta.json.JsonValue
asJsonArray, asJsonObject
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
for serialization- See Also:
- Constant Field Values
-
valueType
private final JsonValue.ValueType valueType
Type of this JsonValue.
-
-
Constructor Detail
-
JsonValueImpl
JsonValueImpl(JsonValue.ValueType valueType)
Default constructor.- Parameters:
valueType
- Type of this JsonValue
-
-
Method Detail
-
getValueType
public JsonValue.ValueType getValueType()
Returns the value type of this JSON value.- Specified by:
getValueType
in interfaceJsonValue
- Returns:
- JSON value type
-
equals
public boolean equals(java.lang.Object obj)
Compares the specified object with thisJsonValue
object for equality. Returnstrue
if and only if the specified object is also a JsonValue, and theirgetValueType()
objects are equal.- Overrides:
equals
in classjava.lang.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 thisJsonValue
object. The hash code of theJsonValue
object is defined to be itsgetValueType()
object's hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code value for this
JsonValue
object
-
-