Class JsonHandler<A,O>

java.lang.Object
com.eclipsesource.json.JsonHandler<A,O>
Type Parameters:
A - The type of handlers used for JSON arrays
O - The type of handlers used for JSON objects

public abstract class JsonHandler<A,O> extends Object
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:

 ["lorem ipsum"]
  ^            ^
  startString  endString
 

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.

See Also: