Package com.fasterxml.jackson.jr.ob.impl
Class ValueWriterLocator
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
-
- com.fasterxml.jackson.jr.ob.impl.ValueWriterLocator
-
public class ValueWriterLocator extends ValueLocatorBase
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 callingperOperationInstance(com.fasterxml.jackson.jr.ob.impl.JSONWriter, int)
: reason for this is that instances use simple caching to handle the common case of repeating types within JSON Arrays.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_features
protected java.util.concurrent.ConcurrentHashMap<ClassKey,java.lang.Integer>
_knownSerTypes
Mapping from classes to resolved type constants or indexes, to use for serialization.protected java.util.concurrent.CopyOnWriteArrayList<ValueWriter>
_knownWriters
protected JSONWriter
_writeContext
protected ReaderWriterModifier
_writerModifier
Provider for reader customizer, if any; may be null.protected ReaderWriterProvider
_writerProvider
Provider for custom writers, if any; may be null.protected static BeanPropertyWriter[]
NO_PROPS_FOR_WRITE
-
Fields inherited from class com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
CACHE_FLAGS, SER_BOOLEAN, SER_BOOLEAN_ARRAY, SER_BYTE_ARRAY, SER_CALENDAR, SER_CHAR, SER_CHAR_ARRAY, SER_CHARACTER_SEQUENCE, SER_CLASS, SER_COLLECTION, SER_DATE, SER_ENUM, SER_FILE, 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_FLOAT, SER_NUMBER_INTEGER, SER_NUMBER_LONG, SER_NUMBER_SHORT, SER_OBJECT_ARRAY, SER_STRING, SER_TREE_NODE, SER_UNKNOWN, SER_URI, SER_URL, SER_UUID
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueWriterLocator(int features, ReaderWriterProvider rwp, ReaderWriterModifier rwm)
Constructor for the blueprint instance (and variations)protected
ValueWriterLocator(ValueWriterLocator base, int features, JSONWriter w)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
_findPOJOSerializationType(java.lang.Class<?> raw)
Method called to locate a serializer for given type and return numeric id.protected POJODefinition
_resolveBeanDef(java.lang.Class<?> raw)
protected BeanPropertyWriter[]
_resolveBeanForSer(java.lang.Class<?> raw, POJODefinition beanDef)
static ValueWriterLocator
blueprint(ReaderWriterProvider rwp, ReaderWriterModifier rwm)
int
findSerializationType(java.lang.Class<?> raw)
The main lookup method used to find type identifier for given raw class; including Bean types (if allowed).ValueWriter
getValueWriter(int index)
ValueWriterLocator
perOperationInstance(JSONWriter w, int features)
ValueWriterLocator
with(ReaderWriterModifier rwm)
ValueWriterLocator
with(ReaderWriterProvider rwp)
-
Methods inherited from class com.fasterxml.jackson.jr.ob.impl.ValueLocatorBase
_findSimpleType
-
-
-
-
Field Detail
-
NO_PROPS_FOR_WRITE
protected static final BeanPropertyWriter[] NO_PROPS_FOR_WRITE
-
_knownSerTypes
protected final java.util.concurrent.ConcurrentHashMap<ClassKey,java.lang.Integer> _knownSerTypes
Mapping from classes to resolved type constants or indexes, to use for serialization.
-
_knownWriters
protected final java.util.concurrent.CopyOnWriteArrayList<ValueWriter> _knownWriters
-
_writerProvider
protected final ReaderWriterProvider _writerProvider
Provider for custom writers, if any; may be null.- Since:
- 2.10
-
_writerModifier
protected final ReaderWriterModifier _writerModifier
Provider for reader customizer, if any; may be null.- Since:
- 2.11
-
_features
protected final int _features
-
_writeContext
protected final JSONWriter _writeContext
-
-
Constructor Detail
-
ValueWriterLocator
protected ValueWriterLocator(int features, ReaderWriterProvider rwp, ReaderWriterModifier rwm)
Constructor for the blueprint instance (and variations)
-
ValueWriterLocator
protected ValueWriterLocator(ValueWriterLocator base, int features, JSONWriter w)
-
-
Method Detail
-
blueprint
public static final ValueWriterLocator blueprint(ReaderWriterProvider rwp, ReaderWriterModifier rwm)
-
with
public ValueWriterLocator with(ReaderWriterProvider rwp)
-
with
public ValueWriterLocator with(ReaderWriterModifier rwm)
-
perOperationInstance
public ValueWriterLocator perOperationInstance(JSONWriter w, int features)
-
getValueWriter
public ValueWriter getValueWriter(int index)
-
findSerializationType
public final int findSerializationType(java.lang.Class<?> raw)
The main lookup method used to find type identifier for given raw class; including Bean types (if allowed).
-
_resolveBeanDef
protected POJODefinition _resolveBeanDef(java.lang.Class<?> raw)
-
_findPOJOSerializationType
protected int _findPOJOSerializationType(java.lang.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):- Custom serializer via
ReaderWriterProvider
- Simple type supported out-of-the-box, for types like
String
,Boolean
,Number
and a small number of other JDK types - Bean-style POJOs with accessors (getters, public fields)
- Custom serializer via
-
_resolveBeanForSer
protected BeanPropertyWriter[] _resolveBeanForSer(java.lang.Class<?> raw, POJODefinition beanDef)
-
-