net.minidev.json
public class JSONNavi<T> extends Object
Constructor and Description |
---|
JSONNavi(AMapper<? super T> mapper) |
JSONNavi(String json) |
JSONNavi(String json,
AMapper<T> mapper) |
JSONNavi(String json,
Class<T> mapTo) |
Modifier and Type | Method and Description |
---|---|
JSONNavi<T> |
add(Object... values)
add value to the current arrays
|
JSONNavi<T> |
array()
Set current value as Json Array You can also skip this call Arrays can be
create automatically.
|
boolean |
asBoolean()
get the current value as boolean if the current Object is null or is not
a boolean return false
|
Boolean |
asBooleanObj()
get the current object value as Boolean if the current Object is not a
Boolean return null.
|
double |
asDouble()
get the current value as double if the current Object is null return
Double.NaN
|
Double |
asDoubleObj()
get the current object value as Double if the current Double can not be
cast as Integer return null.
|
double |
asFloat()
get the current value as float if the current Object is null return
Float.NaN
|
Float |
asFloatObj()
get the current object value as Float if the current Float can not be
cast as Integer return null.
|
int |
asInt()
get the current value as int if the current Object is null return 0
|
Integer |
asIntegerObj()
get the current object value as Integer if the current Object can not be
cast as Integer return null.
|
long |
asLong()
get the current value as long if the current Object is null return 0
|
Long |
asLongObj()
get the current object value as Long if the current Object can not be
cast as Long return null.
|
String |
asString()
get the current object value as String if the current Object is null
return null.
|
JSONNavi<?> |
at(int index)
Access to the index position.
|
JSONNavi<?> |
at(String key) |
JSONNavi<?> |
atNext()
Access to last + 1 the index position.
|
Object |
get(int index) |
Object |
get(String key) |
Object |
getCurrentObject() |
double |
getDouble(String key) |
int |
getInt(String key) |
Integer |
getInteger(String key) |
String |
getJPath() |
Collection<String> |
getKeys() |
T |
getRoot() |
int |
getSize() |
String |
getString(String key) |
boolean |
hasFailure() |
boolean |
hasKey(String key) |
boolean |
isArray()
is the current node is an array
|
boolean |
isObject()
is the current node is an object
|
static JSONNavi<JSONAwareEx> |
newInstance() |
static JSONNavi<JSONArray> |
newInstanceArray() |
static JSONNavi<JSONObject> |
newInstanceObject() |
JSONNavi<T> |
object()
Set current value as Json Object You can also skip this call, Objects can
be create automatically.
|
JSONNavi<T> |
root()
return to root node
|
JSONNavi<T> |
set(Boolean bool)
set current value as Boolean
|
JSONNavi<T> |
set(Number num)
set current value as Number
|
JSONNavi<T> |
set(String text)
set current value as String
|
JSONNavi<T> |
set(String key,
double value)
write an value in the current object
|
JSONNavi<T> |
set(String key,
float value)
write an value in the current object
|
JSONNavi<T> |
set(String key,
int value)
write an value in the current object
|
JSONNavi<T> |
set(String key,
long value)
write an value in the current object
|
JSONNavi<T> |
set(String key,
Number value) |
JSONNavi<T> |
set(String key,
String value) |
String |
toString()
return the Object as a Json String
|
String |
toString(JSONStyle compression)
return the Object as a Json String
|
JSONNavi<?> |
up()
Move one level up in Json tree.
|
JSONNavi<?> |
up(int level)
call up() level times.
|
public JSONNavi(String json)
public static JSONNavi<JSONAwareEx> newInstance()
public static JSONNavi<JSONObject> newInstanceObject()
public boolean hasFailure()
public Object getCurrentObject()
public Collection<String> getKeys()
public int getSize()
public int getInt(String key)
public double getDouble(String key)
public boolean hasKey(String key)
public Object get(int index)
public JSONNavi<T> set(String key, long value)
key
- key to accessvalue
- new valuepublic JSONNavi<T> set(String key, int value)
key
- key to accessvalue
- new valuepublic JSONNavi<T> set(String key, double value)
key
- key to accessvalue
- new valuepublic JSONNavi<T> set(String key, float value)
key
- key to accessvalue
- new valuepublic JSONNavi<T> add(Object... values)
values
- to addpublic String asString()
public double asDouble()
public Double asDoubleObj()
public double asFloat()
public Float asFloatObj()
public int asInt()
public Integer asIntegerObj()
public long asLong()
public Long asLongObj()
public boolean asBoolean()
public Boolean asBooleanObj()
public JSONNavi<T> object()
public JSONNavi<T> array()
public T getRoot()
public boolean isArray()
public boolean isObject()
public JSONNavi<?> at(int index)
index
- 0 based desired position in Arraypublic JSONNavi<?> atNext()
public JSONNavi<?> up(int level)
level
- number of parent move.public JSONNavi<?> up()
public String toString()
public String toString(JSONStyle compression)
compression
- public String getJPath()
Copyright © 2013 Chemouni Uriel. All Rights Reserved.