类 JsonContent

java.lang.Object
org.apache.velocity.tools.generic.JsonContent

public class JsonContent extends Object
Container for *either* an array *or* an object
  • 构造器概要

    构造器
    构造器
    说明
    JsonContent(com.github.cliftonlabs.json_simple.JsonArray array)
    wraps an array
    JsonContent(com.github.cliftonlabs.json_simple.JsonObject object)
    wraps an object
  • 方法概要

    修饰符和类型
    方法
    说明
    get(int index)
    Get a value from root array
    get(String key)
    Get a property from root object
    com.github.cliftonlabs.json_simple.JsonArray
    Gives acces to the wrapped JsonArray, if any
    com.github.cliftonlabs.json_simple.JsonObject
    Gives access to the wrapped JsonObject, if any
    boolean
    Check if wrapped object is a JsonArray
    boolean
    Check if wrapped object is null
    boolean
    Check if wrapped object is a JsonObject
    Get an iterator.
    Iterate keys of root object.
    Get set of root object keys.
    int
    Get size of root object or array.
    Convert JSON object or array into string

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 构造器详细资料

    • JsonContent

      public JsonContent(com.github.cliftonlabs.json_simple.JsonObject object)
      wraps an object
      参数:
      object - JsonObject to wrap
    • JsonContent

      public JsonContent(com.github.cliftonlabs.json_simple.JsonArray array)
      wraps an array
      参数:
      array - JsonArray to wrap
  • 方法详细资料

    • get

      public Object get(int index)
      Get a value from root array
      参数:
      index - array index
      返回:
      value, or null
    • get

      public Object get(String key)
      Get a property from root object
      参数:
      key - map key
      返回:
      property value, or null
    • keys

      public Iterator<String> keys()
      Iterate keys of root object.
      返回:
      iterator
    • keySet

      public Set<String> keySet()
      Get set of root object keys.
      返回:
      keys set
    • iterator

      public Iterator iterator()
      Get an iterator. For a root object, returns an iterator over key names. For a root array, returns an iterator over contained objects.
      返回:
      iterator
    • size

      public int size()
      Get size of root object or array.
      返回:
      size
    • toString

      public String toString()
      Convert JSON object or array into string
      覆盖:
      toString 在类中 Object
      返回:
      JSON representation of the root object or array
    • isNull

      public boolean isNull()
      Check if wrapped object is null
      返回:
      true if wrapped object is null
    • isObject

      public boolean isObject()
      Check if wrapped object is a JsonObject
      返回:
      true if wrapped object is a JsonObject
    • isArray

      public boolean isArray()
      Check if wrapped object is a JsonArray
      返回:
      true if wrapped object is a JsonArray
    • getObject

      public com.github.cliftonlabs.json_simple.JsonObject getObject()
      Gives access to the wrapped JsonObject, if any
      返回:
      JsonObject or null
    • getArray

      public com.github.cliftonlabs.json_simple.JsonArray getArray()
      Gives acces to the wrapped JsonArray, if any
      返回:
      JsonArray or null