Top Description Fields Constructors Methods
tools.jackson.jr.ob.impl

public Class EnumReader

extends ValueReader
Class Inheritance
Imports
java.util.Map, tools.jackson.core.JacksonException, .JsonParser, .JsonToken, tools.jackson.jr.ob.JSONObjectException, tools.jackson.jr.ob.api.ValueReader

Reader for Enum values: needed because we need a simple java.util.Map for efficient conversion from id (gotten with java.lang.Enum#toString() to value.

In future we could consider alternatively allowing use of java.lang.Enum#name() for id.

Field Summary

Modifier and TypeField and Description
protected final Object[]
protected final Map<String, Object>
Inherited from tools.jackson.jr.ob.api.ValueReader:
_valueType

Constructor Summary

AccessConstructor and Description
public
EnumReader(Class<?> enumType, Object[] byIndex, Map<String, Object> byName)

Method Summary

Modifier and TypeMethod and Description
private Object
private String
desc()

public Object
public Object
readNext(JSONReader reader, JsonParser p)

Overrides tools.jackson.jr.ob.api.ValueReader.readNext.

Method called to deserialize value of type supported by this reader, using given parser.

Inherited from tools.jackson.jr.ob.api.ValueReader:
_tokenDesc_tokenDesc_valueTypeDescvalueType

Field Detail

_byIndexback to summary
protected final Object[] _byIndex
_byNameback to summary
protected final Map<String, Object> _byName

Constructor Detail

EnumReaderback to summary
public EnumReader(Class<?> enumType, Object[] byIndex, Map<String, Object> byName)

Method Detail

_enumback to summary
private Object _enum(String id) throws JacksonException
descback to summary
private String desc()
readback to summary
public Object read(JSONReader reader, JsonParser p) throws JacksonException

Implements abstract tools.jackson.jr.ob.api.ValueReader.read.

Annotations
@Override
readNextback to summary
public Object readNext(JSONReader reader, JsonParser p) throws JacksonException

Overrides tools.jackson.jr.ob.api.ValueReader.readNext.

Doc from tools.jackson.jr.ob.api.ValueReader.readNext.

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 accessors in JsonParser, like JsonParser#nextIntValue(int).

Annotations
@Override