Package com.couchbase.client.java.json
Class JsonValue
java.lang.Object
com.couchbase.client.java.json.JsonValue
- Direct Known Subclasses:
JsonArray
,JsonNull
,JsonObject
Represents a JSON value (either a
JsonObject
or a JsonArray
.- Since:
- 2.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Helper method to check if the given item is a supported JSON item.static Object
Returns the given value converted to a type that passes thecheckType(java.lang.Object)
test.static JsonArray
ja()
Static factory method to create an emptyJsonArray
.static JsonObject
jo()
Static factory method to create an emptyJsonObject
.
-
Field Details
-
NULL
Represents a Json "null".
-
-
Constructor Details
-
JsonValue
public JsonValue()
-
-
Method Details
-
jo
Static factory method to create an emptyJsonObject
.- Returns:
- an empty
JsonObject
.
-
ja
Static factory method to create an emptyJsonArray
.- Returns:
- an empty
JsonArray
.
-
checkType
Helper method to check if the given item is a supported JSON item.- Parameters:
item
- the value to check.- Returns:
- true if supported, false otherwise.
-
coerce
Returns the given value converted to a type that passes thecheckType(java.lang.Object)
test.- Throws:
InvalidArgumentException
- if conversion is not possible.
-