- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,JsonValue>
-
- jakarta.json.EmptyObject
-
- All Implemented Interfaces:
JsonObject
,JsonStructure
,JsonValue
,java.io.Serializable
,java.util.Map<java.lang.String,JsonValue>
final class EmptyObject extends java.util.AbstractMap<java.lang.String,JsonValue> implements JsonObject, java.io.Serializable
Private implementation of immutableJsonObject
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface jakarta.json.JsonValue
JsonValue.ValueType
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
for serialization-
Fields inherited from interface jakarta.json.JsonValue
EMPTY_JSON_ARRAY, EMPTY_JSON_OBJECT, FALSE, NULL, TRUE
-
-
Constructor Summary
Constructors Constructor Description EmptyObject()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.util.Map.Entry<java.lang.String,JsonValue>>
entrySet()
boolean
getBoolean(java.lang.String name)
Returns the boolean value of the associated mapping for the specified name.boolean
getBoolean(java.lang.String name, boolean defaultValue)
Returns the boolean value of the associated mapping for the specified name.int
getInt(java.lang.String name)
A convenience method forgetJsonNumber(name).intValue()
int
getInt(java.lang.String name, int defaultValue)
Returns the int value of the associatedJsonNumber
mapping for the specified name.JsonArray
getJsonArray(java.lang.String name)
Returns the array value to which the specified name is mapped.JsonNumber
getJsonNumber(java.lang.String name)
Returns the number value to which the specified name is mapped.JsonObject
getJsonObject(java.lang.String name)
Returns the object value to which the specified name is mapped.JsonString
getJsonString(java.lang.String name)
Returns the string value to which the specified name is mapped.java.lang.String
getString(java.lang.String name)
A convenience method forgetJsonString(name).getString()
java.lang.String
getString(java.lang.String name, java.lang.String defaultValue)
Returns the string value of the associatedJsonString
mapping for the specified name.JsonValue.ValueType
getValueType()
Returns the value type of this JSON value.boolean
isNull(java.lang.String name)
Returnstrue
if the associated value for the specified name isJsonValue.NULL
.private java.lang.Object
readResolve()
Preserves singleton property-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jakarta.json.JsonStructure
getValue
-
Methods inherited from interface jakarta.json.JsonValue
asJsonArray, asJsonObject, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
for serialization- See Also:
- Constant Field Values
-
-
Method Detail
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,JsonValue>> entrySet()
-
getJsonArray
public JsonArray getJsonArray(java.lang.String name)
Description copied from interface:JsonObject
Returns the array value to which the specified name is mapped. This is a convenience method for(JsonArray)get(name)
to get the value.- Specified by:
getJsonArray
in interfaceJsonObject
- Parameters:
name
- the name whose associated value is to be returned- Returns:
- the array value to which the specified name is mapped, or
null
if this object contains no mapping for the name
-
getJsonObject
public JsonObject getJsonObject(java.lang.String name)
Description copied from interface:JsonObject
Returns the object value to which the specified name is mapped. This is a convenience method for(JsonObject)get(name)
to get the value.- Specified by:
getJsonObject
in interfaceJsonObject
- Parameters:
name
- the name whose associated value is to be returned- Returns:
- the object value to which the specified name is mapped, or
null
if this object contains no mapping for the name
-
getJsonNumber
public JsonNumber getJsonNumber(java.lang.String name)
Description copied from interface:JsonObject
Returns the number value to which the specified name is mapped. This is a convenience method for(JsonNumber)get(name)
to get the value.- Specified by:
getJsonNumber
in interfaceJsonObject
- Parameters:
name
- the name whose associated value is to be returned- Returns:
- the number value to which the specified name is mapped, or
null
if this object contains no mapping for the name
-
getJsonString
public JsonString getJsonString(java.lang.String name)
Description copied from interface:JsonObject
Returns the string value to which the specified name is mapped. This is a convenience method for(JsonString)get(name)
to get the value.- Specified by:
getJsonString
in interfaceJsonObject
- Parameters:
name
- the name whose associated value is to be returned- Returns:
- the string value to which the specified name is mapped, or
null
if this object contains no mapping for the name
-
getString
public java.lang.String getString(java.lang.String name)
Description copied from interface:JsonObject
A convenience method forgetJsonString(name).getString()
- Specified by:
getString
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as String- Returns:
- the String value to which the specified name is mapped
-
getString
public java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
Description copied from interface:JsonObject
Returns the string value of the associatedJsonString
mapping for the specified name. IfJsonString
is found, then itsJsonString.getString()
is returned. Otherwise, the specified default value is returned.- Specified by:
getString
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as StringdefaultValue
- a default value to be returned- Returns:
- the string value of the associated mapping for the name, or the default value
-
getInt
public int getInt(java.lang.String name)
Description copied from interface:JsonObject
A convenience method forgetJsonNumber(name).intValue()
- Specified by:
getInt
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as int- Returns:
- the int value to which the specified name is mapped
-
getInt
public int getInt(java.lang.String name, int defaultValue)
Description copied from interface:JsonObject
Returns the int value of the associatedJsonNumber
mapping for the specified name. IfJsonNumber
is found, then itsJsonNumber.intValue()
is returned. Otherwise, the specified default value is returned.- Specified by:
getInt
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as intdefaultValue
- a default value to be returned- Returns:
- the int value of the associated mapping for the name, or the default value
-
getBoolean
public boolean getBoolean(java.lang.String name)
Description copied from interface:JsonObject
Returns the boolean value of the associated mapping for the specified name. If the associated mapping is JsonValue.TRUE, then returns true. If the associated mapping is JsonValue.FALSE, then returns false.- Specified by:
getBoolean
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as boolean- Returns:
- the boolean value to which the specified name is mapped
-
getBoolean
public boolean getBoolean(java.lang.String name, boolean defaultValue)
Description copied from interface:JsonObject
Returns the boolean value of the associated mapping for the specified name. If the associated mapping is JsonValue.TRUE, then returns true. If the associated mapping is JsonValue.FALSE, then returns false. Otherwise, the specified default value is returned.- Specified by:
getBoolean
in interfaceJsonObject
- Parameters:
name
- whose associated value is to be returned as intdefaultValue
- a default value to be returned- Returns:
- the boolean value of the associated mapping for the name, or the default value
-
isNull
public boolean isNull(java.lang.String name)
Description copied from interface:JsonObject
Returnstrue
if the associated value for the specified name isJsonValue.NULL
.- Specified by:
isNull
in interfaceJsonObject
- Parameters:
name
- name whose associated value is checked- Returns:
- return true if the associated value is
JsonValue.NULL
, otherwise false
-
getValueType
public JsonValue.ValueType getValueType()
Description copied from interface:JsonValue
Returns the value type of this JSON value.- Specified by:
getValueType
in interfaceJsonValue
- Returns:
- JSON value type
-
readResolve
private java.lang.Object readResolve()
Preserves singleton property- Returns:
JsonValue.EMPTY_JSON_OBJECT
-
-