- 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 ofJsonValuefor simpleJsonValue.ValueTypes 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 longserialVersionUIDfor serializationprivate JsonValue.ValueTypevalueTypeType 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 booleanequals(java.lang.Object obj)Compares the specified object with thisJsonValueobject for equality.JsonValue.ValueTypegetValueType()Returns the value type of this JSON value.inthashCode()Returns the hash code value for thisJsonValueobject.java.lang.StringtoString()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:
getValueTypein interfaceJsonValue- Returns:
- JSON value type
-
equals
public boolean equals(java.lang.Object obj)
Compares the specified object with thisJsonValueobject for equality. Returnstrueif and only if the specified object is also a JsonValue, and theirgetValueType()objects are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to be compared for equality with this JsonValue- Returns:
trueif the specified object is equal to this JsonValue
-
hashCode
public int hashCode()
Returns the hash code value for thisJsonValueobject. The hash code of theJsonValueobject is defined to be itsgetValueType()object's hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code value for this
JsonValueobject
-
-