Interface OracleJsonValue

    • Method Detail

      • toString

        String toString()
        Returns the JSON text for this value.
        Overrides:
        toString in class Object
        Returns:
        JSON text
      • wrap

        <T> T wrap​(Class<T> wrapper)
        Returns a JSON-P (javax.json) wrapper around this value. For example:
            
              import javax.json.JsonObject;
              ...
              OracleJsonObject oraObject = ...;
              JsonObject  jsonObject = oraObject.wrap(JsonObject.class);
            
            

        The returned object is a logical view of the underlying value. Any changes to the value will be observed by the returned wrapper object. All instances of javax.json.JsonValue produced by JDBC implement the java.sql.Wrapper interface which can be used to map back to an instance of oracle.sql.json.OracleJsonValue. For example:

            
              import javax.json.JsonObject;
              import java.sql.Wrapper
              ...
              JsonObject jsonObject = ...;
              OracleJsonObject oraObject = ((Wrapper)jsonObject).unwrap(OracleJsonObject.class);
            
            

        The following table summarizes the object-model mappings between oracle.sql.json.OracleJsonValue and javax.json.JsonValue.

        oracle.sql.json javax.json
        oracle.sql.json.OracleJsonObject javax.json.JsonObject
        oracle.sql.json.OracleJsonArray javax.json.JsonArray
        oracle.sql.json.OracleJsonString
        oracle.sql.json.OracleJsonTimestamp
        oracle.sql.json.OracleJsonDate
        oracle.sql.json.OracleJsonBinary
        oracle.sql.json.OracleJsonIntervalDS
        oracle.sql.json.OracleJsonIntervalYM
        javax.json.JsonString
        oracle.sql.json.OracleJsonDecimal
        oracle.sql.json.OracleJsonDouble
        oracle.sql.json.OracleJsonFloat
        javax.json.JsonNumber
        oracle.sql.json.OracleJsonValue.TRUE javax.json.JsonValue.TRUE
        oracle.sql.json.OracleJsonValue.FALSE javax.json.JsonValue.FALSE
        oracle.sql.json.OracleJsonValue.NULL javax.json.JsonValue.NULL
        Parameters:
        wrapper - the interface to view this object as. Must be assignable to javax.json.JsonValue
      • asJsonObject

        default OracleJsonObject asJsonObject()
        Returns this value as OracleJsonObject. This method is equivalent to (OracleJsonObject)this.
        Returns:
        the OracleJsonObject
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonObject.
      • asJsonArray

        default OracleJsonArray asJsonArray()
        Returns this value as OracleJsonArray. This method is equivalent to (OracleJsonArray)this.
        Returns:
        the OracleJsonArray
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonArray.
      • asJsonString

        default OracleJsonString asJsonString()
        Returns this value as OracleJsonString. This method is equivalent to (OracleJsonString)this.
        Returns:
        the OracleJsonString
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonString.
      • asJsonDecimal

        default OracleJsonDecimal asJsonDecimal()
        Returns this value as OracleJsonDecimal. This method is equivalent to (OracleJsonDecimal)this.
        Returns:
        the OracleJsonDecimal
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonDecimal.
      • asJsonDouble

        default OracleJsonDouble asJsonDouble()
        Returns this value as OracleJsonDouble. This method is equivalent to (OracleJsonDouble)this.
        Returns:
        the OracleJsonDouble
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonDouble.
      • asJsonFloat

        default OracleJsonFloat asJsonFloat()
        Returns this value as OracleJsonFloat. This method is equivalent to (OracleJsonFloat)this.
        Returns:
        the OracleJsonFloat
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonFloat.
      • asJsonNumber

        default OracleJsonNumber asJsonNumber()
        Returns this value as OracleJsonNumber. This method is equivalent to (OracleJsonNumber)this.
        Returns:
        the OracleJsonNumber
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonNumber.
      • asJsonIntervalDS

        default OracleJsonIntervalDS asJsonIntervalDS()
        Returns this value as OracleJsonIntervalDS. This method is equivalent to (OracleJsonIntervalDS)this.
        Returns:
        the OracleJsonIntervalDS
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonIntervalDS.
      • asJsonIntervalYM

        default OracleJsonIntervalYM asJsonIntervalYM()
        Returns this value as OracleJsonIntervalYM. This method is equivalent to (OracleJsonIntervalYM)this.
        Returns:
        the OracleJsonIntervalYM
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonIntervalYM.
      • asJsonTimestamp

        default OracleJsonTimestamp asJsonTimestamp()
        Returns this value as OracleJsonTimestamp. This method is equivalent to (OracleJsonTimestamp)this.
        Returns:
        the OracleJsonTimestamp
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonTimestamp.
      • asJsonTimestampTZ

        default OracleJsonTimestampTZ asJsonTimestampTZ()
        Returns this value as OracleJsonTimestampTZ. This method is equivalent to (OracleJsonTimestampTZ)this.
        Returns:
        the OracleJsonTimestampTZ
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonTimestampTZ.
      • asJsonDate

        default OracleJsonDate asJsonDate()
        Returns this value as OracleJsonDate. This method is equivalent to (OracleJsonDate)this.
        Returns:
        the OracleJsonDate
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonDate.
      • asJsonBinary

        default OracleJsonBinary asJsonBinary()
        Returns this value as OracleJsonBinary. This method is equivalent to (OracleJsonBinary)this.
        Returns:
        the OracleJsonBinary
        Throws:
        ClassCastException - if this value is not an instance of OracleJsonBinary.