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

public Class ValueWriterLocator

extends ValueLocatorBase
Class Inheritance
Imports
java.lang.reflect.*, java.util.*, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList, com.fasterxml.jackson.jr.ob.JSON, com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier, .ReaderWriterProvider, .ValueWriter

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
private final ClassKey
_key

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

protected final ConcurrentHashMap<ClassKey, Integer>
_knownSerTypes

Mapping from classes to resolved type constants or indexes, to use for serialization.

protected final CopyOnWriteArrayList<ValueWriter>
private Class<?>
private int
protected final JSONWriter
protected final ReaderWriterModifier
_writerModifier

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

protected final ReaderWriterProvider
_writerProvider

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

protected static final BeanPropertyWriter[]
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
ValueWriterLocator(int features, ReaderWriterProvider rwp, ReaderWriterModifier rwm)

Constructor for the blueprint instance (and variations)

protected

Method Summary

Modifier and TypeMethod and Description
protected int
_findPOJOSerializationType(Class<?> raw)

Method called to locate a serializer for given type and return numeric id. Serializer can be found using one of follow methods (in order of lookups):

  1. Custom serializer via ReaderWriterProvider
  2. Simple type supported out-of-the-box, for types like String, Boolean, Number and a small number of other JDK types
  3. Bean-style POJOs with accessors (getters, public fields)
private int
private int
_registerWriter(Class<?> rawType, ValueWriter valueWriter)

protected POJODefinition
protected BeanPropertyWriter[]
public static final ValueWriterLocator
public final int
findSerializationType(Class<?> raw)

The main lookup method used to find type identifier for given raw class; including Bean types (if allowed).

public ValueWriter
getValueWriter(int index)

public ValueWriterLocator
public ValueWriterLocator
public ValueWriterLocator
Inherited from com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase:
_findSimpleType

Field Detail

_featuresback to summary
protected final int _features
_keyback to summary
private final ClassKey _key

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

_knownSerTypesback to summary
protected final ConcurrentHashMap<ClassKey, Integer> _knownSerTypes

Mapping from classes to resolved type constants or indexes, to use for serialization.

_knownWritersback to summary
protected final CopyOnWriteArrayList<ValueWriter> _knownWriters
_prevClassback to summary
private Class<?> _prevClass
_prevTypeback to summary
private int _prevType
_writeContextback to summary
protected final JSONWriter _writeContext
_writerModifierback to summary
protected final ReaderWriterModifier _writerModifier

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

Since
2.11
_writerProviderback to summary
protected final ReaderWriterProvider _writerProvider

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

Since
2.10
NO_PROPS_FOR_WRITEback to summary
protected static final BeanPropertyWriter[] NO_PROPS_FOR_WRITE

Constructor Detail

ValueWriterLocatorback to summary
protected ValueWriterLocator(int features, ReaderWriterProvider rwp, ReaderWriterModifier rwm)

Constructor for the blueprint instance (and variations)

ValueWriterLocatorback to summary
protected ValueWriterLocator(ValueWriterLocator base, int features, JSONWriter w)

Method Detail

_findPOJOSerializationTypeback to summary
protected int _findPOJOSerializationType(Class<?> raw)

Method called to locate a serializer for given type and return numeric id. Serializer can be found using one of follow methods (in order of lookups):

  1. Custom serializer via ReaderWriterProvider
  2. Simple type supported out-of-the-box, for types like String, Boolean, Number and a small number of other JDK types
  3. Bean-style POJOs with accessors (getters, public fields)
_modifyAndRegisterWriterback to summary
private int _modifyAndRegisterWriter(Class<?> rawType, ValueWriter w)
_registerWriterback to summary
private int _registerWriter(Class<?> rawType, ValueWriter valueWriter)
_resolveBeanDefback to summary
protected POJODefinition _resolveBeanDef(Class<?> raw)
_resolveBeanForSerback to summary
protected BeanPropertyWriter[] _resolveBeanForSer(Class<?> raw, POJODefinition beanDef)
blueprintback to summary
public static final ValueWriterLocator blueprint(ReaderWriterProvider rwp, ReaderWriterModifier rwm)
findSerializationTypeback to summary
public final int findSerializationType(Class<?> raw)

The main lookup method used to find type identifier for given raw class; including Bean types (if allowed).

getValueWriterback to summary
public ValueWriter getValueWriter(int index)
perOperationInstanceback to summary
public ValueWriterLocator perOperationInstance(JSONWriter w, int features)
withback to summary
public ValueWriterLocator with(ReaderWriterProvider rwp)
withback to summary
public ValueWriterLocator with(ReaderWriterModifier rwm)