public final class GetArrayElement extends Object implements JSONParseListener
Constructor and Description |
---|
GetArrayElement(int index)
Constructs a GetJSONArrayParseListener that finds the specified index
|
GetArrayElement(int index,
JSONDecoder decoder) |
Modifier and Type | Method and Description |
---|---|
boolean |
abort()
returns whether the parsing can end at this time
|
void |
charRead(int index,
char character)
A character has been read
|
void |
elemEnded(int commaIndex,
char character)
does nothing
|
void |
elemStarted(int commaIndex,
char character)
An element has started
|
void |
ended()
Called when the parsing ends.
|
void |
endingBracket(int index,
char character)
does nothing
|
Object |
getParsedElement()
this returns the element gotten in its parsed form
|
String |
getUnparsedElement()
this returns the element gotten in its unparsed form
|
void |
keyValueSeparation(int colonIndex,
char character)
A key has ended and a value has started
|
void |
openingBracket(int index,
char character)
does nothing
|
void |
started()
Called when the parsing starts.
|
public GetArrayElement(int index, JSONDecoder decoder)
public GetArrayElement(int index)
index
- the index to look forpublic boolean abort() throws IllegalStateException
JSONParseListener
abort
in interface JSONParseListener
IllegalStateException
- if this is called before started or between started and endedpublic void charRead(int index, char character) throws IllegalStateException
JSONParseListener
charRead
in interface JSONParseListener
index
- the index of the charactercharacter
- the read characterIllegalStateException
- if this is called before started or between started and endedpublic void elemStarted(int commaIndex, char character) throws IllegalStateException
JSONParseListener
elemStarted
in interface JSONParseListener
commaIndex
- the index of the commacharacter
- the character that started the elementIllegalStateException
- if this is called before started or between started and endedpublic void keyValueSeparation(int colonIndex, char character) throws IllegalStateException, ParseException, ClassCastException
JSONParseListener
keyValueSeparation
in interface JSONParseListener
colonIndex
- the index of the commacharacter
- the character that split the elementIllegalStateException
- if this is called before started or between started and endedParseException
- if there was a problem with the keyClassCastException
- if the key is not of the JSONString type, or a similar error occurs.public void started() throws IllegalStateException
JSONParseListener
started
in interface JSONParseListener
IllegalStateException
- if this is called before started or between started and endedpublic void ended() throws IllegalStateException, ParseException
JSONParseListener
ended
in interface JSONParseListener
IllegalStateException
- if this is called before started or between started and endedParseException
- if there was an error with the parsingpublic String getUnparsedElement() throws IllegalStateException
IllegalStateException
- if the parsing is not endedpublic Object getParsedElement() throws IllegalStateException, ClassCastException
IllegalStateException
- if the parsing is not endedClassCastException
- if the string does not represent a valid object.public void elemEnded(int commaIndex, char character)
elemEnded
in interface JSONParseListener
commaIndex
- no effectcharacter
- no effectpublic void endingBracket(int index, char character)
endingBracket
in interface JSONParseListener
index
- no effectcharacter
- no effectpublic void openingBracket(int index, char character)
openingBracket
in interface JSONParseListener
index
- no effectcharacter
- no effect