abstract class JsonHandler<A, O>
A handler for parser events. Instances of this class can be given to a JsonParser. The parser will then call the methods of the given handler while reading the input.
The default implementations of these methods do nothing. Subclasses may override only those
methods they are interested in. They can use getLocation()
to access the current
character position of the parser at any point. The start*
methods will be called
while the location points to the first character of the parsed element. The end*
methods will be called while the location points to the character position that directly follows
the last character of the parsed element. Example:
Subclasses that build an object representation of the parsed JSON can return arbitrary handler objects for JSON arrays and JSON objects in .startArray and .startObject. These handler objects will then be provided in all subsequent parser events for this particular array or object. They can be used to keep track the elements of a JSON array or object.
Parameters
Parameters
See Also
JsonHandler()
A handler for parser events. Instances of this class can be given to a JsonParser. The parser will then call the methods of the given handler while reading the input. |
val location: Location
Returns the current parser location. |
open fun endArray(array: A?): Unit
Indicates the end of an array in the JSON input. This method will be called after reading the
closing square bracket character ( |
|
open fun endArrayValue(array: A?): Unit
Indicates the end of an array element in the JSON input. This method will be called after
reading the last character of the element value, just after the |
|
open fun endBoolean(value: Boolean): Unit
Indicates the end of a boolean literal ( |
|
open fun endNull(): Unit
Indicates the end of a |
|
open fun endNumber(string: String): Unit
Indicates the end of a number in the JSON input. This method will be called after reading the last character of the number. |
|
open fun endObject(object: O?): Unit
Indicates the end of an object in the JSON input. This method will be called after reading the
closing curly bracket character ( |
|
open fun endObjectName(object: O?, name: String): Unit
Indicates the end of an object member name in the JSON input. This method will be called after
reading the closing quote character ( |
|
open fun endObjectValue(object: O?, name: String): Unit
Indicates the end of an object member value in the JSON input. This method will be called after
reading the last character of the member value, just after the |
|
open fun endString(string: String): Unit
Indicates the end of a string in the JSON input. This method will be called after reading the
closing double quote character ( |
|
open fun startArray(): A?
Indicates the beginning of an array in the JSON input. This method will be called when reading
the opening square bracket character ( |
|
open fun startArrayValue(array: A?): Unit
Indicates the beginning of an array element in the JSON input. This method will be called when
reading the first character of the element, just before the call to the |
|
open fun startBoolean(): Unit
Indicates the beginning of a boolean literal ( |
|
open fun startNull(): Unit
Indicates the beginning of a |
|
open fun startNumber(): Unit
Indicates the beginning of a number in the JSON input. This method will be called when reading the first character of the number. |
|
open fun startObject(): O?
Indicates the beginning of an object in the JSON input. This method will be called when reading
the opening curly bracket character ( |
|
open fun startObjectName(object: O?): Unit
Indicates the beginning of the name of an object member in the JSON input. This method will be called when reading the opening quote character ('"') of the member name. |
|
open fun startObjectValue(object: O?, name: String): Unit
Indicates the beginning of the name of an object member in the JSON input. This method will be called when reading the opening quote character ('"') of the member name. |
|
open fun startString(): Unit
Indicates the beginning of a string in the JSON input. This method will be called when reading
the opening double quote character ( |