Package com.fasterxml.jackson.jr.ob.api
Class ValueReader
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.api.ValueReader
-
- Direct Known Subclasses:
AnyReader
,ArrayReader
,BeanReader
,CollectionReader
,EnumReader
,MapReader
,SimpleValueReader
public abstract class ValueReader extends java.lang.Object
API and base class for all "deserializer" implementations used to actually read values of Java types from (JSON) input.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<?>
_valueType
Type of values this reader will read
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueReader(java.lang.Class<?> valueType)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.lang.String
_tokenDesc(com.fasterxml.jackson.core.JsonParser p)
Helper method for getting description of the token parser currently points to, for use in descriptions and exception messages.static java.lang.String
_tokenDesc(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken t)
Helper method for getting description of given token for use in descriptions and exception messages.abstract java.lang.Object
read(JSONReader reader, com.fasterxml.jackson.core.JsonParser p)
Method called to deserialize value of type supported by this reader, using given parser.java.lang.Object
readNext(JSONReader reader, com.fasterxml.jackson.core.JsonParser p)
Method called to deserialize value of type supported by this reader, using given parser.java.lang.Class<?>
valueType()
Accessor for non-generic (type-erased) type of values this reader produces from input.
-
-
-
Method Detail
-
read
public abstract java.lang.Object read(JSONReader reader, com.fasterxml.jackson.core.JsonParser p) throws java.io.IOException
Method called to deserialize value of type supported by this reader, using given parser. Parser is already positioned to the (first) token of the value to read.- Parameters:
reader
- Context object that allows calling other read methods for contained values of different types (for example for collection readers).p
- Underlying parser used for reading decoded token stream- Throws:
java.io.IOException
-
readNext
public java.lang.Object readNext(JSONReader reader, com.fasterxml.jackson.core.JsonParser p) throws java.io.IOException
Method called to deserialize value of type supported by this reader, using given parser. Parser is not yet positioned to the (first) token of the value to read and needs to be advanced.Default implementation simply calls `p.nextToken()` first, then calls {#link
read(JSONReader, JsonParser)
, but some implementations may decide to implement this differently to use (slightly) more efficient accessor inJsonParser
, likeJsonParser.nextIntValue(int)
.- Parameters:
reader
- Context object that allows calling other read methods for contained values of different types (for example for collection readers).p
- Underlying parser used for reading decoded token stream- Throws:
java.io.IOException
-
valueType
public java.lang.Class<?> valueType()
Accessor for non-generic (type-erased) type of values this reader produces from input.- Since:
- 2.10
-
_tokenDesc
public static java.lang.String _tokenDesc(com.fasterxml.jackson.core.JsonParser p) throws java.io.IOException
Helper method for getting description of the token parser currently points to, for use in descriptions and exception messages.- Throws:
java.io.IOException
-
_tokenDesc
public static java.lang.String _tokenDesc(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken t) throws java.io.IOException
Helper method for getting description of given token for use in descriptions and exception messages.- Throws:
java.io.IOException
-
-