Class 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 calling perOperationInstance(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 Detail

      • _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
    • Method Detail

      • 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):
        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)