Class JSONReader

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected CollectionBuilder _collectionBuilder
      Handler that takes care of constructing Maps as needed
      protected int _features  
      protected MapBuilder _mapBuilder
      Handler that takes care of constructing Maps as needed
      protected com.fasterxml.jackson.core.JsonParser _parser
      Parser used by this reader instance.
      protected ValueReaderLocator _readerLocator
      Object that is used to find value readers dynamically.
      protected com.fasterxml.jackson.core.TreeCodec _treeCodec
      Configured TreeCodec that is needed if values of type TreeNode are to be read.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        JSONReader​(CollectionBuilder lb, MapBuilder mb)
      Constructor used for creating the blueprint instances.
      protected JSONReader​(JSONReader base, int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p)
      Constructor used for per-operation (non-blueprint) instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected CollectionBuilder _collectionBuilder​(java.lang.Class<?> collType)  
      protected MapBuilder _mapBuilder​(java.lang.Class<?> mapType)  
      protected JSONReader _with​(CollectionBuilder lb, MapBuilder mb)
      Overridable method that all mutant factories call if a new instance is to be constructed
      boolean arraysAsLists()  
      boolean isEnabled​(JSON.Feature f)  
      JSONReader perOperationInstance​(int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p)  
      java.lang.Object[] readArray()
      Method for reading a JSON Array from input and building a Object[] out of it.
      <T> T[] readArrayOf​(java.lang.Class<T> type)  
      <T> T readBean​(java.lang.Class<T> type)
      Method for reading a JSON Object from input and building a Bean of specified type out of it; Bean has to conform to standard Java Bean specification by having setters for passing JSON Object properties.
      java.util.List<java.lang.Object> readList()
      Method for reading a JSON Array from input and building a List out of it.
      <T> java.util.List<T> readListOf​(java.lang.Class<T> type)
      Method for reading a JSON Array from input and building a List out of it, binding values into specified type.
      java.util.Map<java.lang.String,​java.lang.Object> readMap()
      Method for reading a JSON Object from input and building a Map out of it.
      <T> java.util.Map<java.lang.String,​T> readMapOf​(java.lang.Class<T> type)
      Method for reading a JSON Object from input and building a Map out of it, binding values into specified type.
      com.fasterxml.jackson.core.TreeNode readTree()  
      java.lang.Object readValue()
      Method for reading a "simple" Object of type indicated by JSON content: Map for JSON Object, Map for JSON Array (or, Object[] if so configured), String for JSON String value and so on.
      JSONReader with​(CollectionBuilder lb)  
      JSONReader with​(MapBuilder mb)  
      JSONReader withCacheCheck​(int features)  
      • Methods inherited from class java.lang.Object

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

      • _mapBuilder

        protected final MapBuilder _mapBuilder
        Handler that takes care of constructing Maps as needed
      • _collectionBuilder

        protected final CollectionBuilder _collectionBuilder
        Handler that takes care of constructing Maps as needed
      • _features

        protected final int _features
      • _treeCodec

        protected final com.fasterxml.jackson.core.TreeCodec _treeCodec
        Configured TreeCodec that is needed if values of type TreeNode are to be read.
      • _readerLocator

        protected final ValueReaderLocator _readerLocator
        Object that is used to find value readers dynamically.
      • _parser

        protected final com.fasterxml.jackson.core.JsonParser _parser
        Parser used by this reader instance.
    • Constructor Detail

      • JSONReader

        protected JSONReader​(JSONReader base,
                             int features,
                             ValueReaderLocator loc,
                             com.fasterxml.jackson.core.TreeCodec tc,
                             com.fasterxml.jackson.core.JsonParser p)
        Constructor used for per-operation (non-blueprint) instance.
    • Method Detail

      • withCacheCheck

        public JSONReader withCacheCheck​(int features)
      • perOperationInstance

        public JSONReader perOperationInstance​(int features,
                                               ValueReaderLocator loc,
                                               com.fasterxml.jackson.core.TreeCodec tc,
                                               com.fasterxml.jackson.core.JsonParser p)
      • arraysAsLists

        public boolean arraysAsLists()
        Since:
        2.8
      • isEnabled

        public boolean isEnabled​(JSON.Feature f)
        Since:
        2.11
      • readValue

        public java.lang.Object readValue()
                                   throws java.io.IOException
        Method for reading a "simple" Object of type indicated by JSON content: Map for JSON Object, Map for JSON Array (or, Object[] if so configured), String for JSON String value and so on.
        Throws:
        java.io.IOException
      • readMap

        public java.util.Map<java.lang.String,​java.lang.Object> readMap()
                                                                       throws java.io.IOException
        Method for reading a JSON Object from input and building a Map out of it. Note that if input does NOT contain a JSON Object, JSONObjectException will be thrown.
        Throws:
        java.io.IOException
      • readList

        public java.util.List<java.lang.Object> readList()
                                                  throws java.io.IOException
        Method for reading a JSON Array from input and building a List out of it. Note that if input does NOT contain a JSON Array, JSONObjectException will be thrown.
        Throws:
        java.io.IOException
      • readArray

        public java.lang.Object[] readArray()
                                     throws java.io.IOException
        Method for reading a JSON Array from input and building a Object[] out of it. Note that if input does NOT contain a JSON Array, JSONObjectException will be thrown.
        Throws:
        java.io.IOException
      • readBean

        public <T> T readBean​(java.lang.Class<T> type)
                       throws java.io.IOException
        Method for reading a JSON Object from input and building a Bean of specified type out of it; Bean has to conform to standard Java Bean specification by having setters for passing JSON Object properties.
        Throws:
        java.io.IOException
      • readArrayOf

        public <T> T[] readArrayOf​(java.lang.Class<T> type)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readListOf

        public <T> java.util.List<T> readListOf​(java.lang.Class<T> type)
                                         throws java.io.IOException
        Method for reading a JSON Array from input and building a List out of it, binding values into specified type. Note that if input does NOT contain a JSON Array, JSONObjectException will be thrown.
        Throws:
        java.io.IOException
      • readMapOf

        public <T> java.util.Map<java.lang.String,​T> readMapOf​(java.lang.Class<T> type)
                                                              throws java.io.IOException
        Method for reading a JSON Object from input and building a Map out of it, binding values into specified type. Note that if input does NOT contain a JSON Object, JSONObjectException will be thrown.
        Throws:
        java.io.IOException
        Since:
        2.10
      • readTree

        public com.fasterxml.jackson.core.TreeNode readTree()
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.11
      • _mapBuilder

        protected MapBuilder _mapBuilder​(java.lang.Class<?> mapType)
      • _collectionBuilder

        protected CollectionBuilder _collectionBuilder​(java.lang.Class<?> collType)