|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.minidev.json.JSONNavi<T>
public class JSONNavi<T>
A JQuery like Json editor, accessor.
Constructor Summary | |
---|---|
JSONNavi(AMapper<? super T> mapper)
|
|
JSONNavi(String json)
|
|
JSONNavi(String json,
AMapper<T> mapper)
|
|
JSONNavi(String json,
Class<T> mapTo)
|
Method Summary | |
---|---|
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 |
getCurrentObject()
|
String |
getJPath()
|
T |
getRoot()
|
boolean |
hasFailure()
|
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. if no more level up is available the statement had no effect. |
JSONNavi<?> |
up(int level)
call up() level times. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JSONNavi(AMapper<? super T> mapper)
public JSONNavi(String json)
public JSONNavi(String json, AMapper<T> mapper)
public JSONNavi(String json, Class<T> mapTo)
Method Detail |
---|
public static JSONNavi<JSONAwareEx> newInstance()
public static JSONNavi<JSONObject> newInstanceObject()
public static JSONNavi<JSONArray> newInstanceArray()
public JSONNavi<T> root()
public boolean hasFailure()
public Object getCurrentObject()
public JSONNavi<?> at(String key)
public JSONNavi<T> set(String key, String value)
public JSONNavi<T> set(String key, Number value)
public JSONNavi<T> set(String key, long value)
key
- key to accessvalue
- new value
public JSONNavi<T> set(String key, int value)
key
- key to accessvalue
- new value
public JSONNavi<T> set(String key, double value)
key
- key to accessvalue
- new value
public JSONNavi<T> set(String key, float value)
key
- key to accessvalue
- new value
public JSONNavi<T> add(Object... values)
values
- to add
public 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 JSONNavi<T> set(Number num)
public JSONNavi<T> set(Boolean bool)
public JSONNavi<T> set(String text)
public T getRoot()
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()
toString
in class Object
public String toString(JSONStyle compression)
compression
- public String getJPath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |