Class JsonReaderI<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      JsonReader base  
      private static java.lang.String ERR_MSG  
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonReaderI​(JsonReader base)
      Reader can be link to the JsonReader Base
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addValue​(java.lang.Object current, java.lang.Object value)
      add a value in an array json object.
      T convert​(java.lang.Object current)
      Allow a mapper to convert a temporary structure to the final data format.
      java.lang.Object createArray()
      use to instantiate a new object that will be used as an array
      java.lang.Object createObject()
      use to instantiate a new object that will be used as an object
      java.lang.reflect.Type getType​(java.lang.String key)
      Gets the type for the specified key
      java.lang.Object getValue​(java.lang.Object current, java.lang.String key)
      Gets a value from the current object
      void setValue​(java.lang.Object current, java.lang.String key, java.lang.Object value)
      called when json-smart done parsing a value
      JsonReaderI<?> startArray​(java.lang.String key)
      called when json-smart parser start an array.
      JsonReaderI<?> startObject​(java.lang.String key)
      called when json-smart parser meet an object key
      • Methods inherited from class java.lang.Object

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

      • ERR_MSG

        private static java.lang.String ERR_MSG
    • Constructor Detail

      • JsonReaderI

        public JsonReaderI​(JsonReader base)
        Reader can be link to the JsonReader Base
        Parameters:
        base - parent reader
    • Method Detail

      • startObject

        public JsonReaderI<?> startObject​(java.lang.String key)
                                   throws ParseException,
                                          java.io.IOException
        called when json-smart parser meet an object key
        Parameters:
        key - key name
        Returns:
        a JsonReaderI to handle the object parsing
        Throws:
        ParseException - if parsing fails
        java.io.IOException - if I/O error occurs
      • startArray

        public JsonReaderI<?> startArray​(java.lang.String key)
                                  throws ParseException,
                                         java.io.IOException
        called when json-smart parser start an array.
        Parameters:
        key - the destination key name, or null.
        Returns:
        a JsonReaderI to handle the array parsing
        Throws:
        ParseException - if parsing fails
        java.io.IOException - if I/O error occurs
      • setValue

        public void setValue​(java.lang.Object current,
                             java.lang.String key,
                             java.lang.Object value)
                      throws ParseException,
                             java.io.IOException
        called when json-smart done parsing a value
        Parameters:
        current - the current object being built
        key - the key for the value
        value - the parsed value
        Throws:
        ParseException - if parsing fails
        java.io.IOException - if I/O error occurs
      • getValue

        public java.lang.Object getValue​(java.lang.Object current,
                                         java.lang.String key)
        Gets a value from the current object
        Parameters:
        current - the current object
        key - the key to get the value for
        Returns:
        the value associated with the key
      • getType

        public java.lang.reflect.Type getType​(java.lang.String key)
        Gets the type for the specified key
        Parameters:
        key - the key to get the type for
        Returns:
        the Type associated with the key
      • addValue

        public void addValue​(java.lang.Object current,
                             java.lang.Object value)
                      throws ParseException,
                             java.io.IOException
        add a value in an array json object.
        Parameters:
        current - the current array object
        value - the value to add
        Throws:
        ParseException - if parsing fails
        java.io.IOException - if I/O error occurs
      • createObject

        public java.lang.Object createObject()
        use to instantiate a new object that will be used as an object
        Returns:
        a new object instance
      • createArray

        public java.lang.Object createArray()
        use to instantiate a new object that will be used as an array
        Returns:
        a new array instance
      • convert

        public T convert​(java.lang.Object current)
        Allow a mapper to convert a temporary structure to the final data format.

        example: convert an List<Integer> to an int[]

        Parameters:
        current - the current object to convert
        Returns:
        the converted object