Class JSONDefaultHandler

  • All Implemented Interfaces:
    JSONContentHandler

    public class JSONDefaultHandler
    extends java.lang.Object
    implements JSONContentHandler
    Default implementation for the JSONContentHandler interface. This implementation does nothing. It is simply intented to be a convenient class to subclass if you only want to implement a subset of the JSONContentHandler methods.
    Author:
    Chris Burdess
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void booleanValue​(boolean value)
      Notifies of a JSON boolean value.
      void endArray()
      Indicates the end of a JSON array.
      void endObject()
      Indicates the end of a JSON object.
      void key​(java.lang.String key)
      Notifies of a key in a JSON object.
      void nullValue()
      Notifies of a JSON null value.
      void numberValue​(java.lang.Number number)
      Notifies of a JSON number.
      void setLocator​(JSONLocator locator)
      Receive an object that can be used to determine the current location during parsing.
      void startArray()
      Indicates the start of a JSON array.
      void startObject()
      Indicates the start of a JSON object.
      void stringValue​(java.lang.String value)
      Notifies of a JSON string.
      void whitespace​(java.lang.String whitespace)
      Notifies of whitespace in the underlying stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSONDefaultHandler

        public JSONDefaultHandler()
    • Method Detail

      • numberValue

        public void numberValue​(java.lang.Number number)
                         throws JSONException
        Description copied from interface: JSONContentHandler
        Notifies of a JSON number.
        Specified by:
        numberValue in interface JSONContentHandler
        Parameters:
        number - the number parsed: may be an Integer, Long, or Double
        Throws:
        JSONException - the client may throw an exception during processing
      • stringValue

        public void stringValue​(java.lang.String value)
                         throws JSONException
        Description copied from interface: JSONContentHandler
        Notifies of a JSON string.
        Specified by:
        stringValue in interface JSONContentHandler
        Parameters:
        value - the string value, unescaped and unquoted
        Throws:
        JSONException - the client may throw an exception during processing
      • whitespace

        public void whitespace​(java.lang.String whitespace)
                        throws JSONException
        Description copied from interface: JSONContentHandler
        Notifies of whitespace in the underlying stream. Note that whitespace between key strings and their associated colon, if present, will not be reported by this method.
        Specified by:
        whitespace in interface JSONContentHandler
        Parameters:
        whitespace - the whitespace contents as a string
        Throws:
        JSONException - the client may throw an exception during processing
      • key

        public void key​(java.lang.String key)
                 throws JSONException
        Description copied from interface: JSONContentHandler
        Notifies of a key in a JSON object. This is a string followed by a colon inside an object representation in the JSON source. It will always be associated with the most recent previous startObject event.
        Specified by:
        key in interface JSONContentHandler
        Parameters:
        key - the key name
        Throws:
        JSONException - the client may throw an exception during processing
      • setLocator

        public void setLocator​(JSONLocator locator)
        Description copied from interface: JSONContentHandler
        Receive an object that can be used to determine the current location during parsing. The locator allows the application to determine the end position of any parsing-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules).
        Specified by:
        setLocator in interface JSONContentHandler
        Parameters:
        locator - the locator object