Package com.github.wnameless.json.base
Interface JsonValueBase<JVB extends JsonValueBase<JVB>>
- Type Parameters:
JVB- the type of a JSON implementation wrapper
- All Superinterfaces:
Jsonable
- All Known Subinterfaces:
JsonArrayBase<JVB>,JsonArrayCore<JVC>,JsonObjectBase<JVB>,JsonObjectCore<JVC>,JsonValueCore<JVC>
- All Known Implementing Classes:
GsonJsonArray,GsonJsonObject,GsonJsonValue,JacksonJsonArray,JacksonJsonObject,JacksonJsonValue,JakartaJsonArray,JakartaJsonObject,JakartaJsonValue,OrgJsonArray,OrgJsonObject,OrgJsonValue
JsonValueBase defines all essential methods which should be included in any JSON
implementation object. This interface should be used as a wrapper to a JSON value implementation.- Author:
- Wei-Ming Wu
-
Method Summary
Modifier and TypeMethodDescriptionasArray()Converts this to a JSON array wrapper.Converts this to a JavaBigDecimal.Converts this to a JavaBigInteger.booleanConverts this to a Java boolean.doubleasDouble()Converts this to a Java double.intasInt()Converts this to a Java int.longasLong()Converts this to a Java long.default ObjectasNull()Converts this to a Java null.default NumberasNumber()Converts this to a JavaNumber.
ConvertedNumberis chosen fromInteger,Long,BigInteger,DoubleandBigDecimalbased on the size and scale of numeric.asObject()Converts this to a JSON object wrapper.asString()Converts this to a JavaString.asValue()Converts this to a JSON value wrapper.booleanisArray()Checks if this is represented as a JSON array.booleanChecks if this is represented as a JSON boolean.booleanisNull()Checks if this is represented as a JSON null.booleanisNumber()Checks if this is represented as a JSON number.booleanisObject()Checks if this is represented as a JSON object.booleanisString()Checks if this is represented as a JSON string.
-
Method Details
-
isObject
boolean isObject()Checks if this is represented as a JSON object.- Returns:
- true if this is represented as a JSON object, false otherwise
-
isArray
boolean isArray()Checks if this is represented as a JSON array.- Returns:
- true if this is represented as a JSON array, false otherwise
-
isString
boolean isString()Checks if this is represented as a JSON string.- Returns:
- true if this is represented as a JSON string, false otherwise
-
isBoolean
boolean isBoolean()Checks if this is represented as a JSON boolean.- Returns:
- true if this is represented as a JSON boolean, false otherwise
-
isNumber
boolean isNumber()Checks if this is represented as a JSON number.- Returns:
- true if this is represented as a JSON number, false otherwise
-
isNull
boolean isNull()Checks if this is represented as a JSON null.- Returns:
- true if this is represented as a JSON null, false otherwise
-
asString
String asString()Converts this to a JavaString.- Returns:
- a
String
-
asBoolean
boolean asBoolean()Converts this to a Java boolean.- Returns:
- a boolean
-
asInt
int asInt()Converts this to a Java int.- Returns:
- an int
-
asLong
long asLong()Converts this to a Java long.- Returns:
- a long
-
asBigInteger
BigInteger asBigInteger()Converts this to a JavaBigInteger.- Returns:
- a
BigInteger
-
asDouble
double asDouble()Converts this to a Java double.- Returns:
- a double
-
asBigDecimal
BigDecimal asBigDecimal()Converts this to a JavaBigDecimal.- Returns:
- a
BigDecimal
-
asNumber
Converts this to a JavaNumber.
ConvertedNumberis chosen fromInteger,Long,BigInteger,DoubleandBigDecimalbased on the size and scale of numeric.- Returns:
- a
Number
-
asNull
Converts this to a Java null.- Returns:
- a null
-
asObject
JsonObjectBase<JVB> asObject()Converts this to a JSON object wrapper.- Returns:
- a JSON object wrapper
-
asArray
JsonArrayBase<JVB> asArray()Converts this to a JSON array wrapper.- Returns:
- a JSON array wrapper
-
asValue
JsonValueBase<JVB> asValue()Converts this to a JSON value wrapper.- Returns:
- a JSON value wrapper
-