java.lang.Object
io.helidon.json.JsonValue
io.helidon.json.JsonObject
Represents a JSON object value containing key-value pairs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for creating JsonObject instances with a fluent API. -
Method Summary
Modifier and TypeMethodDescriptionarrayValue(String key) Return the JsonArray value associated with the specified key as an Optional.arrayValue(String key, JsonArray defaultValue) Return the JsonArray value associated with the specified key, or the default value if the key is not present.bigIntegerValue(String key) Return the BigInteger value associated with the specified key as an Optional.bigIntegerValue(String key, BigInteger defaultValue) Return the BigInteger value associated with the specified key, or the default value if the key is not present.booleanValue(String key) Return the boolean value associated with the specified key as an Optional.booleanbooleanValue(String key, boolean defaultValue) Return the boolean value associated with the specified key, or the default value if the key is not present.static JsonObject.Builderbuilder()Create a new JsonObject.Builder for fluent construction of JsonObject instances.Return the byte value associated with the specified key as an Optional.byteReturn the byte value associated with the specified key, or the default value if the key is not present.booleancontainsKey(String key) Checks if this object contains the specified key.static JsonObjectCreate a JsonObject from a map of string keys to JsonValue instances.doubleValue(String key) Return the double value associated with the specified key as an Optional.doubledoubleValue(String key, double defaultValue) Return the double value associated with the specified key, or the default value if the key is not present.static JsonObjectempty()Returns the shared empty JSON object instance.booleanfloatValue(String key) Return the float value associated with the specified key as an Optional.floatfloatValue(String key, float defaultValue) Return the float value associated with the specified key, or the default value if the key is not present.inthashCode()Return the integer value associated with the specified key as an Optional.intReturn the integer value associated with the specified key, or the default value if the key is not present.keys()Return a set of all keys in this object as JsonString instances.Return a set of all keys in this object as String instances.Return the long value associated with the specified key as an Optional.longReturn the long value associated with the specified key, or the default value if the key is not present.numberValue(String key) Return the BigDecimal value associated with the specified key as an Optional.numberValue(String key, BigDecimal defaultValue) Return the BigDecimal value associated with the specified key, or the default value if the key is not present.objectValue(String key) Return the JsonObject value associated with the specified key as an Optional.objectValue(String key, JsonObject defaultValue) Return the JsonObject value associated with the specified key, or the default value if the key is not present.shortValue(String key) Return the short value associated with the specified key as an Optional.shortshortValue(String key, short defaultValue) Return the short value associated with the specified key, or the default value if the key is not present.intsize()Return the number of properties in this object.stringValue(String key) Return the string value associated with the specified key as an Optional.stringValue(String key, String defaultValue) Return the string value associated with the specified key, or the default value if the key is not present.voidtoJson(JsonGenerator generator) Write this JSON value to the provided generator.type()Return the type of this JSON value.Return the value associated with the specified key, or the empty value if the key is not present.Return the value associated with the specified key, or the default value if the key is not present.
-
Method Details
-
builder
Create a new JsonObject.Builder for fluent construction of JsonObject instances.- Returns:
- a new JsonObject.Builder
-
create
Create a JsonObject from a map of string keys to JsonValue instances.- Parameters:
content- the map containing the object properties- Returns:
- a new JsonObject
-
empty
Returns the shared empty JSON object instance.- Returns:
- the empty JSON object
-
containsKey
Checks if this object contains the specified key.- Parameters:
key- the key to check for- Returns:
- true if the object contains the key, false otherwise
-
value
Return the value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the value associated with the key, or the default value
-
value
Return the value associated with the specified key, or the empty value if the key is not present.- Parameters:
key- the key to look up- Returns:
- the value associated with the key, or empty
-
booleanValue
Return the boolean value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the boolean value, or empty if the key is not present
-
booleanValue
Return the boolean value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the boolean value associated with the key, or the default value
-
objectValue
Return the JsonObject value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the JsonObject value, or empty if the key is not present
-
objectValue
Return the JsonObject value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the JsonObject value associated with the key, or the default value
-
stringValue
Return the string value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the string value, or empty if the key is not present
-
stringValue
Return the string value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the string value associated with the key, or the default value
-
byteValue
Return the byte value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the byte value, or empty if the key is not present
-
byteValue
Return the byte value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the byte value associated with the key, or the default value
-
shortValue
Return the short value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the short value, or empty if the key is not present
-
shortValue
Return the short value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the short value associated with the key, or the default value
-
intValue
Return the integer value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the integer value, or empty if the key is not present
-
intValue
Return the integer value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the integer value associated with the key, or the default value
-
longValue
Return the long value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the long value, or empty if the key is not present
-
longValue
Return the long value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the long value associated with the key, or the default value
-
floatValue
Return the float value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the float value, or empty if the key is not present
-
floatValue
Return the float value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the float value associated with the key, or the default value
-
doubleValue
Return the double value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the double value, or empty if the key is not present
-
doubleValue
Return the double value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the double value associated with the key, or the default value
-
bigIntegerValue
Return the BigInteger value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the BigInteger value, or empty if the key is not present
-
bigIntegerValue
Return the BigInteger value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the BigInteger value associated with the key, or the default value
-
numberValue
Return the BigDecimal value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the BigDecimal value, or empty if the key is not present
-
numberValue
Return the BigDecimal value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the BigDecimal value associated with the key, or the default value
-
arrayValue
Return the JsonArray value associated with the specified key as an Optional.- Parameters:
key- the key to look up- Returns:
- an Optional containing the JsonArray value, or empty if the key is not present
-
arrayValue
Return the JsonArray value associated with the specified key, or the default value if the key is not present.- Parameters:
key- the key to look updefaultValue- the value to return if the key is not present- Returns:
- the JsonArray value associated with the key, or the default value
-
keys
Return a set of all keys in this object as JsonString instances.- Returns:
- a set of JsonString keys
-
keysAsStrings
Return a set of all keys in this object as String instances.- Returns:
- a set of String keys
-
size
public int size()Return the number of properties in this object.- Returns:
- the size of this object
-
type
Description copied from class:JsonValueReturn the type of this JSON value. -
toJson
Description copied from class:JsonValueWrite this JSON value to the provided generator. -
hashCode
public int hashCode() -
equals
-