类 JsonContent
java.lang.Object
org.apache.velocity.tools.generic.JsonContent
Container for *either* an array *or* an object
-
构造器概要
构造器构造器说明JsonContent(com.github.cliftonlabs.json_simple.JsonArray array) wraps an arrayJsonContent(com.github.cliftonlabs.json_simple.JsonObject object) wraps an object -
方法概要
修饰符和类型方法说明get(int index) Get a value from root arrayGet a property from root objectcom.github.cliftonlabs.json_simple.JsonArraygetArray()Gives acces to the wrapped JsonArray, if anycom.github.cliftonlabs.json_simple.JsonObjectGives access to the wrapped JsonObject, if anybooleanisArray()Check if wrapped object is a JsonArraybooleanisNull()Check if wrapped object is nullbooleanisObject()Check if wrapped object is a JsonObjectiterator()Get an iterator.keys()Iterate keys of root object.keySet()Get set of root object keys.intsize()Get size of root object or array.toString()Convert JSON object or array into string
-
构造器详细资料
-
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
Get a value from root array- 参数:
index- array index- 返回:
- value, or null
-
get
Get a property from root object- 参数:
key- map key- 返回:
- property value, or null
-
keys
Iterate keys of root object.- 返回:
- iterator
-
keySet
Get set of root object keys.- 返回:
- keys set
-
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
Convert JSON object or array into string -
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
-