Class JsonReaderI<T>

java.lang.Object
net.minidev.json.writer.JsonReaderI<T>
Type Parameters:
T - result type
Direct Known Subclasses:
ArraysMapper, BeansMapper, BeansMapper.Bean, BeansMapper.BeanNoConv, CollectionMapper.ListClass, CollectionMapper.ListType, CollectionMapper.MapClass, CollectionMapper.MapType, CompessorMapper, DefaultMapper, DefaultMapperCollection, DefaultMapperOrdered, FakeMapper, MapperRemapped, UpdaterMapper

public abstract class JsonReaderI<T> extends Object
Default datatype mapper use by Json-smart ton store data.
Author:
uriel Chemouni
  • Field Details

  • Constructor Details

    • JsonReaderI

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

    • startObject

      public JsonReaderI<?> startObject(String key) throws ParseException, 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
      IOException - if I/O error occurs
    • startArray

      public JsonReaderI<?> startArray(String key) throws ParseException, 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
      IOException - if I/O error occurs
    • setValue

      public void setValue(Object current, String key, Object value) throws ParseException, 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
      IOException - if I/O error occurs
    • getValue

      public Object getValue(Object current, 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 Type getType(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(Object current, Object value) throws ParseException, 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
      IOException - if I/O error occurs
    • createObject

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

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

      public T convert(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