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

public interface JsonValueBase<JVB extends JsonValueBase<JVB>> extends Jsonable
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 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 Java String.
      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 Java BigInteger.
      Returns:
      a BigInteger
    • asDouble

      double asDouble()
      Converts this to a Java double.
      Returns:
      a double
    • asBigDecimal

      BigDecimal asBigDecimal()
      Converts this to a Java BigDecimal.
      Returns:
      a BigDecimal
    • asNumber

      default Number asNumber()
      Converts this to a Java Number.

      Converted Number is chosen from Integer, Long, BigInteger, Double and BigDecimal based on the size and scale of numeric.
      Returns:
      a Number
    • asNull

      default Object 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