|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.directwebremoting.json.parse.impl.StatefulJsonDecoder
public abstract class StatefulJsonDecoder
A stateful implementation of JsonDecoder where we track the stack
of objects and allow a subclass to have a simpler set of things to do
| Constructor Summary | |
|---|---|
StatefulJsonDecoder()
|
|
| Method Summary | |
|---|---|
void |
add(java.lang.String propertyName,
java.lang.Object value)
Add the add methods do basically the same thing - add themselves to the current object or array. |
void |
addBoolean(java.lang.String propertyName,
boolean value)
Add a boolean member. |
void |
addNull(java.lang.String propertyName)
Add a null member. |
void |
addNumber(java.lang.String propertyName,
java.lang.String intPart,
java.lang.String floatPart,
java.lang.String expPart)
Add a numeric member. |
void |
addString(java.lang.String propertyName,
java.lang.String value)
Add a string member. |
void |
beginArray(java.lang.String propertyName)
We have encountered a [. |
void |
beginObject(java.lang.String propertyName)
We have encountered a {. |
void |
endArray(java.lang.String propertyName)
We have encountered a ]. |
void |
endObject(java.lang.String propertyName)
We have encountered a }. |
java.lang.Object |
getRoot()
When the parse is finished, this gives access to the result |
static java.lang.Object |
realizeNumber(java.lang.String intPart,
java.lang.String floatPart,
java.lang.String expPart)
Create a BigDecimal, double, int, or long depending on the input
strings. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StatefulJsonDecoder()
| Method Detail |
|---|
public java.lang.Object getRoot()
throws JsonParseException
JsonDecoder
getRoot in interface JsonDecoderJsonParseException
public void beginObject(java.lang.String propertyName)
throws JsonParseException
JsonDecoderpropertyName argument will be null,
otherwise it will contain the name that this object will be assigned to
in the parent object.
What follows is a series of addXxxx() calls, possibly nested
arrays and objects, followed by a call to JsonDecoder.endObject(String)
beginObject in interface JsonDecoderJsonParseException
public void endObject(java.lang.String propertyName)
throws JsonParseException
JsonDecoderJsonDecoder.beginObject(String)
The propertyName argument will match the value given in the
corresponding JsonDecoder.beginObject(String) call.
endObject in interface JsonDecoderJsonParseException
public void beginArray(java.lang.String propertyName)
throws JsonParseException
JsonDecoderpropertyName argument will be null,
otherwise it will contain the name that this object will be assigned to
in the parent object.
What follows is a series of addXxxxx() calls, possibly including nested
arrays and objects, followed by a call to JsonDecoder.endArray(String).
beginArray in interface JsonDecoderJsonParseException
public void endArray(java.lang.String propertyName)
throws JsonParseException
JsonDecoderJsonDecoder.beginArray(String)
The propertyName argument will match the value given in the
corresponding JsonDecoder.beginArray(String) call.
endArray in interface JsonDecoderJsonParseExceptionJsonDecoder.beginArray(String)
public void add(java.lang.String propertyName,
java.lang.Object value)
throws JsonParseException
JsonParseException
public void addString(java.lang.String propertyName,
java.lang.String value)
throws JsonParseException
JsonDecoderpropertyName
argument will be the part of the JSON string before the ':'. If the
member is added to an array, then propertyName will be null.
See the note on JsonDecoder.beginObject(String)
addString in interface JsonDecoderJsonParseException
public void addNumber(java.lang.String propertyName,
java.lang.String intPart,
java.lang.String floatPart,
java.lang.String expPart)
throws JsonParseException
JsonDecoderJsonDecoder.addString(String, String) for the meaning of the
propertyName argument.
The 3 parts are put together like this:
{intPart}[.{floatPart}][E{expPart}]. For example:
addNumber in interface JsonDecoderJsonParseException
public void addBoolean(java.lang.String propertyName,
boolean value)
throws JsonParseException
JsonDecoderJsonDecoder.addString(String, String) for the meaning of the
propertyName argument.
addBoolean in interface JsonDecoderJsonParseException
public void addNull(java.lang.String propertyName)
throws JsonParseException
JsonDecoderJsonDecoder.addString(String, String) for the meaning of the
propertyName argument.
addNull in interface JsonDecoderJsonParseException
public static java.lang.Object realizeNumber(java.lang.String intPart,
java.lang.String floatPart,
java.lang.String expPart)
BigDecimal, double, int, or long depending on the input
strings.
intPart - A string of [0-9]* representing the integer part of the
number.floatPart - A string of \.[0-9]* representing the floating point part
of the number. This INCLUDES the periodexpPart - A string of [eE][+-]?[0-9]* representing the integer part
of the number. This includes the 'e' or 'E'.
|
Copyright ยจ 2008 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||