public class EnumReader extends ValueReader
Map
for efficient conversion from id (gotten with Enum.toString()
to value.
In future we could consider alternatively allowing use of
Enum.name() for id.
| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
_byIndex |
protected Map<String,Object> |
_byName |
_valueType| Constructor and Description |
|---|
EnumReader(Class<?> enumType,
Object[] byIndex,
Map<String,Object> byName) |
| Modifier and Type | Method and Description |
|---|---|
Object |
read(JSONReader reader,
com.fasterxml.jackson.core.JsonParser p)
Method called to deserialize value of type supported by this reader, using
given parser.
|
Object |
readNext(JSONReader reader,
com.fasterxml.jackson.core.JsonParser p)
Method called to deserialize value of type supported by this reader, using
given parser.
|
_tokenDesc, _tokenDesc, valueTypeprotected final Object[] _byIndex
public Object readNext(JSONReader reader, com.fasterxml.jackson.core.JsonParser p) throws IOException
ValueReader
Default implementation simply calls `p.nextToken()` first, then calls
{#link ValueReader.read(JSONReader, JsonParser), but some implementations
may decide to implement this differently to use (slightly) more efficient
accessor in JsonParser, like JsonParser.nextIntValue(int).
readNext in class ValueReaderreader - 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 streamIOExceptionpublic Object read(JSONReader reader, com.fasterxml.jackson.core.JsonParser p) throws IOException
ValueReaderread in class ValueReaderreader - 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 streamIOExceptionCopyright © 2022 FasterXML. All rights reserved.