Interface JsonObject

All Superinterfaces:
JsonValue

public interface JsonObject extends JsonValue
Represents a Json object. Abstracted from javax.json (J2EE) and Jersey.
Author:
Holger Eichelberger, SSE
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this object contains a certain key.
    boolean
    Returns the boolean value of the associated mapping for the specified name.
    int
    getInt(String name)
    Returns the int value of the associated mapping for the specified name.
    Returns the object array to which the specified name is mapped.
    Returns the number to which the specified name is mapped.
    Returns the object value to which the specified name is mapped.
    Returns the string to which the specified name is mapped.
    Returns the string value of the associated mapping for the specified name.
    Returns the value of the associated mapping for the specified name.
    boolean
    Returns true if this object contains no key-value mappings.
    boolean
    isNull(String name)
    Returns true if the associated value for the specified name is a JSON null.
    Returns the keys of the key-value pairs of this object.

    Methods inherited from interface de.iip_ecosphere.platform.support.json.JsonValue

    asJsonObject
  • Method Details

    • getJsonObject

      JsonObject getJsonObject(String name)
      Returns the object value to which the specified name is mapped.
      Parameters:
      name - the name whose associated value is to be returned
      Returns:
      the object value to which the specified name is mapped, or null if this object contains no mapping for name
      Throws:
      ClassCastException - if the value to which the specified name is mapped is not assignable to JsonObject type
    • getJsonArray

      JsonArray getJsonArray(String name)
      Returns the object array to which the specified name is mapped.
      Parameters:
      name - the name whose associated array is to be returned
      Returns:
      the array value to which the specified name is mapped, or null if this object contains no mapping for name
      Throws:
      ClassCastException - if the value to which the specified name is mapped is not assignable to JsonArray type
    • getJsonNumber

      JsonNumber getJsonNumber(String name)
      Returns the number to which the specified name is mapped.
      Parameters:
      name - the name whose associated number is to be returned
      Returns:
      the number to which the specified name is mapped, or null if this object contains no mapping for name
      Throws:
      ClassCastException - if the value to which the specified name is mapped is not assignable to JsonNumber type
    • getJsonString

      JsonString getJsonString(String name)
      Returns the string to which the specified name is mapped.
      Parameters:
      name - the name whose associated string is to be returned
      Returns:
      the string to which the specified name is mapped, or null if this object contains no mapping for name
      Throws:
      ClassCastException - if the value to which the specified name is mapped is not assignable to JsonString type
    • getString

      String getString(String name)
      Returns the string value of the associated mapping for the specified name.
      Parameters:
      name - whose associated value is to be returned as string
      Returns:
      the string value to which the specified name is mapped
      Throws:
      NullPointerException - if the specified name doesn't have any mapping
      ClassCastException - if the value for specified name mapping is not assignable
    • getInt

      int getInt(String name)
      Returns the int value of the associated mapping for the specified name.
      Parameters:
      name - whose associated value is to be returned as int
      Returns:
      the int value to which the specified name is mapped
      Throws:
      NullPointerException - if the specified name doesn't have any mapping
      ClassCastException - if the value for specified name mapping is not assignable
    • getBoolean

      boolean getBoolean(String name)
      Returns the boolean value of the associated mapping for the specified name.
      Parameters:
      name - whose associated value is to be returned as boolean
      Returns:
      the boolean value to which the specified name is mapped
      Throws:
      NullPointerException - if the specified name doesn't have any mapping
      ClassCastException - if the value for specified name mapping is not assignable
    • isNull

      boolean isNull(String name)
      Returns true if the associated value for the specified name is a JSON null.
      Parameters:
      name - name whose associated value is checked
      Returns:
      return true if the associated value is JSON null, otherwise false
      Throws:
      NullPointerException - if the specified name doesn't have anymapping
    • getValue

      JsonValue getValue(String name)
      Returns the value of the associated mapping for the specified name.
      Parameters:
      name - whose associated value is to be returned as boolean
      Returns:
      the value to which the specified name is mapped
      Throws:
      NullPointerException - if the specified name doesn't have any mapping
      ClassCastException - if the value for specified name mapping is not assignable
    • isEmpty

      boolean isEmpty()
      Returns true if this object contains no key-value mappings.
      Returns:
      true if this object contains no key-value mappings
    • keys

      Set<String> keys()
      Returns the keys of the key-value pairs of this object.
      Returns:
      the keys
    • containsKey

      boolean containsKey(String key)
      Returns whether this object contains a certain key.
      Parameters:
      key - the key
      Returns:
      true for contains, false else