JSON
Version 1.0

org.codehaus.jackson
Class JsonReadContext

java.lang.Object
  extended by org.codehaus.jackson.JsonReadContext

public abstract class JsonReadContext
extends Object

Context object is used to keep track of relative logical position of the current event when parsing.


Nested Class Summary
static class JsonReadContext.Type
          Type of the context
 
Field Summary
static int HANDLED_EXPECT_NAME
           
static int HANDLED_EXPECT_VALUE
           
protected static int INT_COLON
           
protected static int INT_COMMA
           
protected  int mIndex
          Index of the currently processed entry.
static int MISSING_COLON
           
static int MISSING_COMMA
           
protected  JsonReadContext mParent
           
static int NOT_EXP_SEPARATOR_NEED_NAME
           
static int NOT_EXP_SEPARATOR_NEED_VALUE
           
 
Constructor Summary
JsonReadContext(JsonReadContext parent, ReaderBasedParserBase ir)
           
 
Method Summary
protected abstract  void appendDesc(StringBuilder sb)
           
 JsonReadContext createChildArrayContext(ReaderBasedParserBase ir)
           
 JsonReadContext createChildObjectContext(ReaderBasedParserBase ir)
           
static JsonReadContext createRootContext(ReaderBasedParserBase ir)
           
 int getCurrentIndex()
           
abstract  String getCurrentName()
           
 int getEntryCount()
           
 JsonReadContext getParent()
           
 JsonLocation getStartLocation(Object srcRef)
           
abstract  JsonReadContext.Type getType()
           
 String getTypeDesc()
           
abstract  int handleSeparator(int ch)
           
abstract  boolean isArray()
           
abstract  boolean isObject()
           
 boolean isRoot()
           
 void setCurrentName(String name)
          Method only to be called in the object context
 String toString()
          Overridden to provide developer readable "JsonPath" representation of the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INT_COLON

protected static final int INT_COLON
See Also:
Constant Field Values

INT_COMMA

protected static final int INT_COMMA
See Also:
Constant Field Values

HANDLED_EXPECT_NAME

public static final int HANDLED_EXPECT_NAME
See Also:
Constant Field Values

HANDLED_EXPECT_VALUE

public static final int HANDLED_EXPECT_VALUE
See Also:
Constant Field Values

MISSING_COMMA

public static final int MISSING_COMMA
See Also:
Constant Field Values

MISSING_COLON

public static final int MISSING_COLON
See Also:
Constant Field Values

NOT_EXP_SEPARATOR_NEED_VALUE

public static final int NOT_EXP_SEPARATOR_NEED_VALUE
See Also:
Constant Field Values

NOT_EXP_SEPARATOR_NEED_NAME

public static final int NOT_EXP_SEPARATOR_NEED_NAME
See Also:
Constant Field Values

mParent

protected final JsonReadContext mParent

mIndex

protected int mIndex
Index of the currently processed entry. Starts with -1 to signal that no entries have been started, and gets advanced each time a new entry is started, either by encountering an expected separator, or with new values if no separators are expected (the case for root context).

Constructor Detail

JsonReadContext

public JsonReadContext(JsonReadContext parent,
                       ReaderBasedParserBase ir)
Method Detail

createRootContext

public static JsonReadContext createRootContext(ReaderBasedParserBase ir)

createChildArrayContext

public final JsonReadContext createChildArrayContext(ReaderBasedParserBase ir)

createChildObjectContext

public final JsonReadContext createChildObjectContext(ReaderBasedParserBase ir)

getParent

public final JsonReadContext getParent()

isRoot

public final boolean isRoot()

getEntryCount

public final int getEntryCount()
Returns:
Number of entries that are complete and started.

getCurrentIndex

public final int getCurrentIndex()
Returns:
Index of the currently processed entry, if any

getStartLocation

public final JsonLocation getStartLocation(Object srcRef)
Returns:
Location pointing to the point where the context start marker was found

getType

public abstract JsonReadContext.Type getType()

isArray

public abstract boolean isArray()

isObject

public abstract boolean isObject()

getTypeDesc

public final String getTypeDesc()

handleSeparator

public abstract int handleSeparator(int ch)

getCurrentName

public abstract String getCurrentName()

appendDesc

protected abstract void appendDesc(StringBuilder sb)

setCurrentName

public void setCurrentName(String name)
Method only to be called in the object context


toString

public final String toString()
Overridden to provide developer readable "JsonPath" representation of the context.

Overrides:
toString in class Object

JSON
Version 1.0

Apache License, Version 2.0