net.arnx.jsonic
Class JSON.Context

java.lang.Object
  extended by net.arnx.jsonic.JSON.Context
Enclosing class:
JSON

public final class JSON.Context
extends Object


Constructor Summary
JSON.Context()
           
 
Method Summary
<T> T
convert(Object key, Object value, Class<? extends T> c)
           
 Object convert(Object key, Object value, Type t)
           
 int getDepth()
          Returns the current depth.
 NamingStyle getEnumStyle()
           
 JSONHint getHint()
          Returns the current hint annotation.
 String getIndentText()
           
 int getInitialIndent()
           
 Object getKey()
          Returns the current key object.
 Object getKey(int depth)
          Returns the key object in any depth.
 int getLevel()
          Deprecated. 
 net.arnx.jsonic.util.LocalCache getLocalCache()
           
 Locale getLocale()
           
 int getMaxDepth()
           
 JSON.Mode getMode()
           
 NamingStyle getPropertyStyle()
           
 TimeZone getTimeZone()
           
 boolean isPrettyPrint()
           
 boolean isSuppressNull()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSON.Context

public JSON.Context()
Method Detail

getLocale

public Locale getLocale()

getTimeZone

public TimeZone getTimeZone()

getMaxDepth

public int getMaxDepth()

isPrettyPrint

public boolean isPrettyPrint()

getInitialIndent

public int getInitialIndent()

getIndentText

public String getIndentText()

isSuppressNull

public boolean isSuppressNull()

getMode

public JSON.Mode getMode()

getPropertyStyle

public NamingStyle getPropertyStyle()

getEnumStyle

public NamingStyle getEnumStyle()

getLocalCache

public net.arnx.jsonic.util.LocalCache getLocalCache()

getLevel

@Deprecated
public int getLevel()
Deprecated. 

Returns the current level. This method renames to getDepth

Returns:
depth number. 0 is root node.

getDepth

public int getDepth()
Returns the current depth.

Returns:
depth number. 0 is root node.

getKey

public Object getKey()
Returns the current key object.

Returns:
Root node is '$'. When the parent is a array, the key is Integer, otherwise String.

getKey

public Object getKey(int depth)
Returns the key object in any depth. the negative value means relative to current depth.

Returns:
Root node is '$'. When the parent is a array, the key is Integer, otherwise String.

getHint

public JSONHint getHint()
Returns the current hint annotation.

Returns:
the current annotation if present on this context, else null.

convert

public <T> T convert(Object key,
                     Object value,
                     Class<? extends T> c)
          throws Exception
Throws:
Exception

convert

public Object convert(Object key,
                      Object value,
                      Type t)
               throws Exception
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object