Top Description Fields Constructors Methods
com.fasterxml.jackson.jr.ob.impl

public Class ValueReaderLocator

extends ValueLocatorBase
Class Inheritance
Imports
java.lang.reflect.*, java.util.*, java.util.concurrent.ConcurrentHashMap, com.fasterxml.jackson.jr.ob.JSON, com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier, .ReaderWriterProvider, .ValueReader, com.fasterxml.jackson.jr.type.ResolvedType, .TypeBindings, .TypeResolver

Helper object used for efficient detection of type information relevant to our conversion needs when writing out Java Objects as JSON.

Note that usage pattern is such that a single "root" instance is kept by each com.fasterxml.jackson.jr.ob.JSON instance; and an actual per-operation instance must be constructed by calling perOperationInstance: reason for this is that instances use simple caching to handle the common case of repeating types within JSON Arrays.

Field Summary

Modifier and TypeField and Description
protected final int
_features

Feature flags that are enabled

protected Map<ClassKey, ValueReader>
_incompleteReaders

During resolution, some readers may be in-progress, but need to be linked: for example, with cyclic type references.

private ClassKey
_key

Reusable lookup key; only used by per-thread instances.

protected final ConcurrentHashMap<ClassKey, ValueReader>
_knownReaders

Set of ValueReaders that we have resolved

protected final JSONReader
protected final Object
_readerLock

Object used for mutex during construction of a Bean deserializer: necessary to avoid race conditions during handling of cyclic dependencies.

protected final ReaderWriterModifier
_readerModifier

Provider for reader customizer, if any; may be null.

protected final ReaderWriterProvider
_readerProvider

Provider for custom readers, if any; may be null.

protected final TypeResolver
_typeResolver

For generic containers (Collections, Maps, arrays), we may need this guy.

protected static final int
MAX_CACHED_READERS

While we should be able to cache all types in the active working set, we should also avoid potential unbounded retention, since there is often just one big instance per JVM (or at least ClassLoader).

Inherited from com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase:
CACHE_FLAGSSER_BOOLEANSER_BOOLEAN_ARRAYSER_BOOLEAN_WRAPPERSER_BYTE_ARRAYSER_CALENDARSER_CHARSER_CHAR_ARRAYSER_CHARACTER_SEQUENCESER_CLASSSER_COLLECTIONSER_DATESER_ENUMSER_FILESER_INT_ARRAYSER_ITERABLESER_LISTSER_LONG_ARRAYSER_MAPSER_NUMBER_BIG_DECIMALSER_NUMBER_BIG_INTEGERSER_NUMBER_BYTESER_NUMBER_DOUBLESER_NUMBER_DOUBLE_WRAPPERSER_NUMBER_FLOATSER_NUMBER_FLOAT_WRAPPERSER_NUMBER_INTEGERSER_NUMBER_INTEGER_WRAPPERSER_NUMBER_LONGSER_NUMBER_LONG_WRAPPERSER_NUMBER_SHORTSER_OBJECT_ARRAYSER_PATHSER_STRINGSER_TREE_NODESER_UNKNOWNSER_URISER_URLSER_UUID

Constructor Summary

AccessConstructor and Description
protected
ValueReaderLocator(ReaderWriterProvider rwp, ReaderWriterModifier rwm)

Constructor for the blueprint instance

protected
protected

Method Summary

Modifier and TypeMethod and Description
private TypeBindings
_bindings(Class<?> ctxt)

protected ValueReader
_createReader(Class<?> contextType, Class<?> type, Type genericType)

protected POJODefinition
protected BeanReader
protected ValueReader
arrayReader(Class<?> contextType, Class<?> arrayType)

protected ValueReader
beanReader(Class<?> type)

public static final ValueReaderLocator
protected ValueReader
collectionReader(Class<?> contextType, Type collectionType)

protected ValueReader
collectionReader(Class<?> collectionType, ResolvedType valueType)

protected ValueReader
createReader(Class<?>
Context for resolving generic type parameters
contextType
,
Class<?>
Type-erased type of value to construct reader for
type
,
Type
Full (possibly) generic type of value to construct reader for (important for java.util.Map, java.util.Collection).
genericType
)

Factory method for creating standard readers of any declared type.

protected ValueReader
enumReader(Class<?> enumType)

public ValueReader

Returns:

ValueReader to use for given type
findReader
(Class<?>
Type-erased type of value to find reader for
raw
)

Method used during deserialization to find handler for given non-generic type: will first check for already resolved (and cached) readers -- and return if one found -- and then if no cached reader found, create one, cache, return.

protected ValueReader
mapReader(Class<?> contextType, Type mapType)

protected ValueReader
mapReader(Class<?> mapType, ResolvedType valueType)

public ValueReaderLocator
public ReaderWriterModifier
public ReaderWriterProvider
public ValueReaderLocator
public ValueReaderLocator
Inherited from com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase:
_findSimpleType

Field Detail

_featuresback to summary
protected final int _features

Feature flags that are enabled

_incompleteReadersback to summary
protected Map<ClassKey, ValueReader> _incompleteReaders

During resolution, some readers may be in-progress, but need to be linked: for example, with cyclic type references.

_keyback to summary
private ClassKey _key

Reusable lookup key; only used by per-thread instances.

_knownReadersback to summary
protected final ConcurrentHashMap<ClassKey, ValueReader> _knownReaders

Set of ValueReaders that we have resolved

_readContextback to summary
protected final JSONReader _readContext
_readerLockback to summary
protected final Object _readerLock

Object used for mutex during construction of a Bean deserializer: necessary to avoid race conditions during handling of cyclic dependencies.

_readerModifierback to summary
protected final ReaderWriterModifier _readerModifier

Provider for reader customizer, if any; may be null.

Since
2.11
_readerProviderback to summary
protected final ReaderWriterProvider _readerProvider

Provider for custom readers, if any; may be null.

Since
2.10
_typeResolverback to summary
protected final TypeResolver _typeResolver

For generic containers (Collections, Maps, arrays), we may need this guy.

MAX_CACHED_READERSback to summary
protected static final int MAX_CACHED_READERS

While we should be able to cache all types in the active working set, we should also avoid potential unbounded retention, since there is often just one big instance per JVM (or at least ClassLoader).

Constructor Detail

ValueReaderLocatorback to summary
protected ValueReaderLocator(ReaderWriterProvider rwp, ReaderWriterModifier rwm)

Constructor for the blueprint instance

ValueReaderLocatorback to summary
protected ValueReaderLocator(ValueReaderLocator base, int features, JSONReader r)
ValueReaderLocatorback to summary
protected ValueReaderLocator(ValueReaderLocator base, ReaderWriterProvider rwp, ReaderWriterModifier rwm)

Method Detail

_bindingsback to summary
private TypeBindings _bindings(Class<?> ctxt)
_createReaderback to summary
protected ValueReader _createReader(Class<?> contextType, Class<?> type, Type genericType)
_resolveBeanDefback to summary
protected POJODefinition _resolveBeanDef(Class<?> raw)
_resolveBeanForDeserback to summary
protected BeanReader _resolveBeanForDeser(Class<?> raw, POJODefinition beanDef)
arrayReaderback to summary
protected ValueReader arrayReader(Class<?> contextType, Class<?> arrayType)
beanReaderback to summary
protected ValueReader beanReader(Class<?> type)
blueprintback to summary
public static final ValueReaderLocator blueprint(ReaderWriterProvider rwp, ReaderWriterModifier rwm)
collectionReaderback to summary
protected ValueReader collectionReader(Class<?> contextType, Type collectionType)
collectionReaderback to summary
protected ValueReader collectionReader(Class<?> collectionType, ResolvedType valueType)
createReaderback to summary
protected ValueReader createReader(Class<?> contextType, Class<?> type, Type genericType)

Factory method for creating standard readers of any declared type.

Parameters
contextType:Class<?>

Context for resolving generic type parameters

type:Class<?>

Type-erased type of value to construct reader for

genericType:Type

Full (possibly) generic type of value to construct reader for (important for java.util.Map, java.util.Collection).

enumReaderback to summary
protected ValueReader enumReader(Class<?> enumType)
findReaderback to summary
public ValueReader findReader(Class<?> raw)

Method used during deserialization to find handler for given non-generic type: will first check for already resolved (and cached) readers -- and return if one found -- and then if no cached reader found, create one, cache, return.

Parameters
raw:Class<?>

Type-erased type of value to find reader for

Returns:ValueReader

ValueReader to use for given type

mapReaderback to summary
protected ValueReader mapReader(Class<?> contextType, Type mapType)
mapReaderback to summary
protected ValueReader mapReader(Class<?> mapType, ResolvedType valueType)
perOperationInstanceback to summary
public ValueReaderLocator perOperationInstance(JSONReader r, int features)
readerWriterModifierback to summary
public ReaderWriterModifier readerWriterModifier()
readerWriterProviderback to summary
public ReaderWriterProvider readerWriterProvider()
withback to summary
public ValueReaderLocator with(ReaderWriterProvider rwp)
withback to summary
public ValueReaderLocator with(ReaderWriterModifier rwm)