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
public interface JsonValueBase<JVB extends JsonValueBase<JVB>> extends Jsonable
JsonValueBasedefines 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description JsonArrayBase<JVB>asArray()Converts this to a JSON array wrapper.BigDecimalasBigDecimal()Converts this to a JavaBigDecimal.BigIntegerasBigInteger()Converts this to a JavaBigInteger.booleanasBoolean()Converts 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.JsonObjectBase<JVB>asObject()Converts this to a JSON object wrapper.StringasString()Converts this to a JavaString.JsonValueBase<JVB>asValue()Converts this to a JSON value wrapper.booleanisArray()Checks if this is represented as a JSON array.booleanisBoolean()Checks 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 Detail
-
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
-
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
-
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
default Number asNumber()
Converts this to a JavaNumber.
ConvertedNumberis chosen fromInteger,Long,BigInteger,DoubleandBigDecimalbased on the size and scale of numeric.- Returns:
- a
Number
-
asNull
default Object asNull()
Converts this to a Java null.- Returns:
- a null
-
-