|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.portalpages.rest.utils.JSONParser
public class JSONParser
This JSON parser handles simple objects only. It is very limited, and does not handle arrays, or non-string object types. It also only handles escaped quotes and slashes, and only allows double quotes around values, not single quotes.
Field Summary | |
---|---|
protected static char |
CLOSE_CURLY_BRACKET
|
protected static char |
COMMA
|
protected static char |
ESCAPE
|
protected java.lang.String |
m_strObjectName
|
protected XPHashtable |
m_xpMembers
|
protected static char |
OPEN_CURLY_BRACKET
|
protected static char |
QUOTE
|
protected static char |
SEMI_COLON
|
Method Summary | |
---|---|
java.lang.String |
GetEscapedTokenAndEndQuote(XPStringTokenizer _tokenizer)
This gets an escaped quoted sequence, starting immediately after the opening quote. |
static IJSONParser |
GetInstance()
|
java.lang.String |
GetMember(java.lang.String _strName)
|
java.lang.String |
GetObjectName()
|
java.lang.String |
GetToken(XPStringTokenizer _tokenizer)
|
boolean |
IsWhiteSpace(java.lang.String _strToken)
Checks if a token is a single piece of whitespace. |
void |
ParseJSONObject(java.lang.String _strJSON)
Parses the supplied JSON object. |
void |
SkipToken(XPStringTokenizer _tokenizer,
char _token)
Skip the next token if it matches the expected token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final char OPEN_CURLY_BRACKET
protected static final char CLOSE_CURLY_BRACKET
protected static final char QUOTE
protected static final char SEMI_COLON
protected static final char COMMA
protected static final char ESCAPE
protected java.lang.String m_strObjectName
protected XPHashtable m_xpMembers
Method Detail |
---|
public static IJSONParser GetInstance()
public void ParseJSONObject(java.lang.String _strJSON)
IJSONParser
ParseJSONObject
in interface IJSONParser
_strJSON
- the JSON string to be parsed.public java.lang.String GetToken(XPStringTokenizer _tokenizer)
_tokenizer
- the JSON tokenizer
public void SkipToken(XPStringTokenizer _tokenizer, char _token)
_tokenizer
- the JSON tokenizer_token
- the expected token
XPFormatException
- if the next token doesn't match the expected token.public boolean IsWhiteSpace(java.lang.String _strToken)
_strToken
-
public java.lang.String GetEscapedTokenAndEndQuote(XPStringTokenizer _tokenizer)
_tokenizer
-
XPFormatException
public java.lang.String GetObjectName()
GetObjectName
in interface IJSONParser
public java.lang.String GetMember(java.lang.String _strName)
GetMember
in interface IJSONParser
_strName
- The key for the JSON member to be returned.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |