net.minidev.json
Class JSONNavi

java.lang.Object
  extended by net.minidev.json.JSONNavi

public class JSONNavi
extends Object

A JQuery like Json editor, accessor.

Since:
1.0.9
Author:
Uriel Chemouni

Constructor Summary
JSONNavi()
           
JSONNavi(ContainerFactory factory)
           
JSONNavi(String json)
           
 
Method Summary
 JSONNavi add(Object... values)
           
 JSONNavi array()
          Set current value as Json Array You can also skip this call Arrays can be create automatically.
 boolean asBoolean()
           
 Boolean asBooleanObj()
          get the current object value as Boolean if the current Object is not a Boolean return null.
 double asDouble()
           
 Double asDoubleObj()
          get the current object value as Double if the current Double can not be cast as Integer return null.
 double asFloat()
           
 Float asFloatObj()
          get the current object value as Float if the current Float can not be cast as Integer return null.
 int asInt()
           
 Integer asIntegerObj()
          get the current object value as Integer if the current Object can not be cast as Integer return null.
 long asLong()
           
 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.
 String getJPath()
           
 boolean hasFailure()
           
static JSONNavi newInstance()
           
 JSONNavi object()
          Set current value as Json Object You can also skip this call, Objects can be create automatically.
 JSONNavi root()
           
 JSONNavi set(Boolean bool)
          set current value as Boolean
 JSONNavi set(Number num)
          set current value as Number
 JSONNavi set(String text)
          set current value as String
 JSONNavi set(String key, double value)
           
 JSONNavi set(String key, float value)
           
 JSONNavi set(String key, int value)
           
 JSONNavi set(String key, long value)
           
 JSONNavi set(String key, Number value)
           
 JSONNavi 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

JSONNavi

public JSONNavi()

JSONNavi

public JSONNavi(String json)

JSONNavi

public JSONNavi(ContainerFactory factory)
Method Detail

newInstance

public static JSONNavi newInstance()

root

public JSONNavi root()

hasFailure

public boolean hasFailure()

at

public JSONNavi at(String key)

set

public JSONNavi set(String key,
                    String value)

set

public JSONNavi set(String key,
                    Number value)

set

public JSONNavi set(String key,
                    long value)

set

public JSONNavi set(String key,
                    int value)

set

public JSONNavi set(String key,
                    double value)

set

public JSONNavi set(String key,
                    float value)

add

public JSONNavi add(Object... values)

asString

public String asString()
get the current object value as String if the current Object is null return null.


asDouble

public double asDouble()

asDoubleObj

public Double asDoubleObj()
get the current object value as Double if the current Double can not be cast as Integer return null.


asFloat

public double asFloat()

asFloatObj

public Float asFloatObj()
get the current object value as Float if the current Float can not be cast as Integer return null.


asInt

public int asInt()

asIntegerObj

public Integer asIntegerObj()
get the current object value as Integer if the current Object can not be cast as Integer return null.


asLong

public long asLong()

asLongObj

public Long asLongObj()
get the current object value as Long if the current Object can not be cast as Long return null.


asBoolean

public boolean asBoolean()

asBooleanObj

public Boolean asBooleanObj()
get the current object value as Boolean if the current Object is not a Boolean return null.


object

public JSONNavi object()
Set current value as Json Object You can also skip this call, Objects can be create automatically.


array

public JSONNavi array()
Set current value as Json Array You can also skip this call Arrays can be create automatically.


set

public JSONNavi set(Number num)
set current value as Number


set

public JSONNavi set(Boolean bool)
set current value as Boolean


set

public JSONNavi set(String text)
set current value as String


at

public JSONNavi at(int index)
Access to the index position. If index is less than 0 access element index from the end like in python.

Parameters:
index - desired position in Array

atNext

public JSONNavi atNext()
Access to last + 1 the index position. this method can only be used in writing mode.


up

public JSONNavi up(int level)
call up() level times.

Parameters:
level - number of parent move.

up

public JSONNavi up()
Move one level up in Json tree. if no more level up is available the statement had no effect.


toString

public String toString()
return the Object as a Json String

Overrides:
toString in class Object

toString

public String toString(JSONStyle compression)
return the Object as a Json String

Parameters:
compression -

getJPath

public String getJPath()


Copyright © 2011 Chemouni Uriel. All Rights Reserved.