Package com.fasterxml.jackson.jr.ob.impl
Class ValueReaderLocator
java.lang.Object
com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
com.fasterxml.jackson.jr.ob.impl.ValueReaderLocator
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 JSON instance; and
an actual per-operation instance must be constructed by calling
perOperationInstance(com.fasterxml.jackson.jr.ob.impl.JSONReader, int): reason for this is that instances
use simple caching to handle the common case of repeating types
within JSON Arrays.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intFeature flags that are enabledprotected Map<ClassKey,ValueReader> During resolution, some readers may be in-progress, but need to be linked: for example, with cyclic type references.protected final ConcurrentHashMap<ClassKey,ValueReader> Set ofValueReaders that we have resolvedprotected final JSONReaderprotected final ObjectObject used for mutex during construction of a Bean deserializer: necessary to avoid race conditions during handling of cyclic dependencies.protected final ReaderWriterModifierProvider for reader customizer, if any; may be null.protected final ReaderWriterProviderProvider for custom readers, if any; may be null.protected final TypeResolverFor generic containers (Collections, Maps, arrays), we may need this guy.protected static final intWhile 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).Fields inherited from class com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
CACHE_FLAGS, SER_BOOLEAN, SER_BOOLEAN_ARRAY, SER_BOOLEAN_WRAPPER, SER_BYTE_ARRAY, SER_CALENDAR, SER_CHAR, SER_CHAR_ARRAY, SER_CHARACTER_SEQUENCE, SER_CLASS, SER_COLLECTION, SER_DATE, SER_DOUBLE_ARRAY, SER_ENUM, SER_FILE, SER_FLOAT_ARRAY, SER_INT_ARRAY, SER_ITERABLE, SER_LIST, SER_LONG_ARRAY, SER_MAP, SER_NUMBER_BIG_DECIMAL, SER_NUMBER_BIG_INTEGER, SER_NUMBER_BYTE, SER_NUMBER_DOUBLE, SER_NUMBER_DOUBLE_WRAPPER, SER_NUMBER_FLOAT, SER_NUMBER_FLOAT_WRAPPER, SER_NUMBER_INTEGER, SER_NUMBER_INTEGER_WRAPPER, SER_NUMBER_LONG, SER_NUMBER_LONG_WRAPPER, SER_NUMBER_SHORT, SER_OBJECT_ARRAY, SER_PATH, SER_SHORT_ARRAY, SER_STRING, SER_TREE_NODE, SER_UNKNOWN, SER_URI, SER_URL, SER_UUID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for the blueprint instanceprotectedValueReaderLocator(ValueReaderLocator base, int features, JSONReader r) protectedValueReaderLocator(ValueReaderLocator base, ReaderWriterProvider rwp, ReaderWriterModifier rwm) -
Method Summary
Modifier and TypeMethodDescriptionprotected ValueReader_createReader(Class<?> contextType, Class<?> type, Type genericType) protected POJODefinition_resolveBeanDef(Class<?> raw) protected BeanReader_resolveBeanForDeser(Class<?> raw, POJODefinition beanDef) protected ValueReaderarrayReader(Class<?> contextType, Class<?> arrayType) protected ValueReaderbeanReader(Class<?> type) static final ValueReaderLocatorprotected ValueReadercollectionReader(Class<?> collectionType, ResolvedType valueType) protected ValueReadercollectionReader(Class<?> contextType, Type collectionType) protected ValueReadercreateReader(Class<?> contextType, Class<?> type, Type genericType) Factory method for creating standard readers of any declared type.protected ValueReaderenumReader(Class<?> enumType) 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.protected ValueReadermapReader(Class<?> mapType, ResolvedType valueType) protected ValueReaderperOperationInstance(JSONReader r, int features) with(ReaderWriterModifier rwm) with(ReaderWriterProvider rwp) Methods inherited from class com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
_findSimpleType
-
Field Details
-
MAX_CACHED_READERS
protected static final int MAX_CACHED_READERSWhile 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).- See Also:
-
_typeResolver
For generic containers (Collections, Maps, arrays), we may need this guy. -
_readerProvider
Provider for custom readers, if any; may be null.- Since:
- 2.10
-
_readerModifier
Provider for reader customizer, if any; may be null.- Since:
- 2.11
-
_knownReaders
Set ofValueReaders that we have resolved -
_incompleteReaders
During resolution, some readers may be in-progress, but need to be linked: for example, with cyclic type references. -
_readerLock
Object used for mutex during construction of a Bean deserializer: necessary to avoid race conditions during handling of cyclic dependencies. -
_features
protected final int _featuresFeature flags that are enabled -
_readContext
-
-
Constructor Details
-
ValueReaderLocator
Constructor for the blueprint instance -
ValueReaderLocator
-
ValueReaderLocator
protected ValueReaderLocator(ValueReaderLocator base, ReaderWriterProvider rwp, ReaderWriterModifier rwm)
-
-
Method Details
-
blueprint
public static final ValueReaderLocator blueprint(ReaderWriterProvider rwp, ReaderWriterModifier rwm) -
with
-
with
-
perOperationInstance
-
readerWriterProvider
-
readerWriterModifier
-
findReader
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- Type-erased type of value to find reader for- Returns:
- ValueReader to use for given type
-
createReader
Factory method for creating standard readers of any declared type.- Parameters:
contextType- Context for resolving generic type parameterstype- Type-erased type of value to construct reader forgenericType- Full (possibly) generic type of value to construct reader for (important forMap,Collection).
-
_createReader
-
arrayReader
-
enumReader
-
collectionReader
-
collectionReader
-
mapReader
-
mapReader
-
beanReader
-
_resolveBeanDef
-
_resolveBeanForDeser
-