SerializerProvider
Date: 2016-12-04

com.fasterxml.jackson.databind

## Class SerializerProvider

- java.lang.Object
- - com.fasterxml.jackson.databind.DatabindContext
  - - com.fasterxml.jackson.databind.SerializerProvider

- Direct Known Subclasses:
    DefaultSerializerProvider

      public abstract class SerializerProvider
      extends DatabindContext

  Class that defines API used by `ObjectMapper` and `JsonSerializer`s to obtain serializers capable of serializing instances of specific types; as well as the default implementation of the functionality.

  Provider handles caching aspects of serializer handling; all construction details are delegated to `SerializerFactory` instance.

  Object life-cycle is such that an initial instance ("blueprint") is created and referenced by `ObjectMapper` and `ObjectWriter` intances; but for actual usage, a configured instance is created by using a create method in sub-class `DefaultSerializerProvider`. Only this instance can be used for actual serialization calls; blueprint object is only to be used for creating instances.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ContextAttributes` | `_attributes` Lazily-constructed holder for per-call attributes.
    `protected SerializationConfig` | `_config` Serialization configuration to use for serialization processing.
    `protected java.text.DateFormat` | `_dateFormat` Lazily acquired and instantiated formatter object: initialized first time it is needed, reused afterwards.
    `protected JsonSerializer<java.lang.Object>` | `_keySerializer` Serializer used to output non-null keys of Maps (which will get output as JSON Objects), if not null; if null, us the standard default key serializer.
    `protected ReadOnlyClassToSerializerMap` | `_knownSerializers` For fast lookups, we will have a local non-shared read-only map that contains serializers previously fetched.
    `protected JsonSerializer<java.lang.Object>` | `_nullKeySerializer` Serializer used to (try to) output a null key, due to an entry of `Map` having null key.
    `protected JsonSerializer<java.lang.Object>` | `_nullValueSerializer` Serializer used to output a null value.
    `protected java.lang.Class<?>` | `_serializationView` View used for currently active serialization, if any.
    `protected SerializerCache` | `_serializerCache` Cache for doing type-to-value-serializer lookups.
    `protected SerializerFactory` | `_serializerFactory` Factory used for constructing actual serializer instances.
    `protected boolean` | `_stdNullValueSerializer` Flag set to indicate that we are using vanilla null value serialization
    `protected JsonSerializer<java.lang.Object>` | `_unknownTypeSerializer` Serializer that gets called for values of types for which no serializers can be constructed.
    `protected static boolean` | `CACHE_UNKNOWN_MAPPINGS` Setting for determining whether mappings for "unknown classes" should be cached for faster resolution.
    `static JsonSerializer<java.lang.Object>` | `DEFAULT_NULL_KEY_SERIALIZER`
    `protected static JsonSerializer<java.lang.Object>` | `DEFAULT_UNKNOWN_SERIALIZER` Placeholder serializer used when `java.lang.Object` typed property is marked to be serialized.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `SerializerProvider()` Constructor for creating master (or "blue-print") provider object, which is only used as the template for constructing per-binding instances.
    `protected` | `SerializerProvider(SerializerProvider src)` Copy-constructor used when making a copy of a blueprint instance.
    `protected` | `SerializerProvider(SerializerProvider src, SerializationConfig config, SerializerFactory f)` "Copy-constructor", used by sub-classes when creating actual non-blueprint instances to use.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JsonSerializer<java.lang.Object>` | `_createAndCacheUntypedSerializer(java.lang.Class<?> rawType)` Method that will try to construct a value serializer; and if one is successfully created, cache it for reuse.
    `protected JsonSerializer<java.lang.Object>` | `_createAndCacheUntypedSerializer(JavaType type)`
    `protected JsonSerializer<java.lang.Object>` | `_createUntypedSerializer(JavaType type)`
    `protected java.text.DateFormat` | `_dateFormat()`
    `protected java.lang.String` | `_desc(java.lang.Object value)`
    `protected JsonSerializer<java.lang.Object>` | `_findExplicitUntypedSerializer(java.lang.Class<?> runtimeType)` Method that will try to find a serializer, either from cache or by constructing one; but will not return an "unknown" serializer if this can not be done but rather returns null.
    `protected JsonSerializer<java.lang.Object>` | `_handleContextualResolvable(JsonSerializer<?> ser, BeanProperty property)` Helper method called to resolve and contextualize given serializer, if and as necessary.
    `protected JsonSerializer<java.lang.Object>` | `_handleResolvable(JsonSerializer<?> ser)`
    `protected java.lang.String` | `_quotedString(java.lang.Object value)`
    `protected void` | `_reportIncompatibleRootType(java.lang.Object value, JavaType rootType)`
    `boolean` | `canOverrideAccessModifiers()` Convenience method for accessing serialization view in use (if any); equivalent to:
    `void` | `defaultSerializeDateKey(java.util.Date date, com.fasterxml.jackson.core.JsonGenerator gen)` Method that will handle serialization of Dates used as `Map` keys, based on `SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS` value (and if using textual representation, configured date format)
    `void` | `defaultSerializeDateKey(long timestamp, com.fasterxml.jackson.core.JsonGenerator gen)` Method that will handle serialization of Dates used as `Map` keys, based on `SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS` value (and if using textual representation, configured date format)
    `void` | `defaultSerializeDateValue(java.util.Date date, com.fasterxml.jackson.core.JsonGenerator gen)` Method that will handle serialization of Date(-like) values, using `SerializationConfig` settings to determine expected serialization behavior.
    `void` | `defaultSerializeDateValue(long timestamp, com.fasterxml.jackson.core.JsonGenerator gen)` Method that will handle serialization of Date(-like) values, using `SerializationConfig` settings to determine expected serialization behavior.
    `void` | `defaultSerializeField(java.lang.String fieldName, java.lang.Object value, com.fasterxml.jackson.core.JsonGenerator gen)` Convenience method that will serialize given field with specified value.
    `void` | `defaultSerializeNull(com.fasterxml.jackson.core.JsonGenerator gen)`
    `void` | `defaultSerializeValue(java.lang.Object value, com.fasterxml.jackson.core.JsonGenerator gen)` Convenience method that will serialize given value (which can be null) using standard serializer locating functionality.
    `JsonSerializer<java.lang.Object>` | `findKeySerializer(java.lang.Class<?> rawKeyType, BeanProperty property)`
    `JsonSerializer<java.lang.Object>` | `findKeySerializer(JavaType keyType, BeanProperty property)` Method called to get the serializer to use for serializing non-null Map keys.
    `JsonSerializer<java.lang.Object>` | `findNullKeySerializer(JavaType serializationType, BeanProperty property)` Method called to find a serializer to use for null values for given declared type.
    `JsonSerializer<java.lang.Object>` | `findNullValueSerializer(BeanProperty property)` Method called to get the serializer to use for serializing null values for specified property.
    `abstract WritableObjectId` | `findObjectId(java.lang.Object forPojo, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generatorType)` Method called to find the Object Id for given POJO, if one has been generated.
    `JsonSerializer<java.lang.Object>` | `findPrimaryPropertySerializer(java.lang.Class<?> valueType, BeanProperty property)`
    `JsonSerializer<java.lang.Object>` | `findPrimaryPropertySerializer(JavaType valueType, BeanProperty property)` Similar to `findValueSerializer(JavaType, BeanProperty)`, but used when finding "primary" property value serializer (one directly handling value of the property).
    `JsonSerializer<java.lang.Object>` | `findTypedValueSerializer(java.lang.Class<?> valueType, boolean cache, BeanProperty property)` Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence.
    `JsonSerializer<java.lang.Object>` | `findTypedValueSerializer(JavaType valueType, boolean cache, BeanProperty property)` Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence.
    `TypeSerializer` | `findTypeSerializer(JavaType javaType)` Method called to get the `TypeSerializer` to use for including Type Id necessary for serializing for the given Java class.
    `JsonSerializer<java.lang.Object>` | `findValueSerializer(java.lang.Class<?> valueType)` Method variant used when we do NOT want contextualization to happen; it will need to be handled at a later point, but caller wants to be able to do that as needed; sometimes to avoid infinite loops
    `JsonSerializer<java.lang.Object>` | `findValueSerializer(java.lang.Class<?> valueType, BeanProperty property)` Method called to get hold of a serializer for a value of given type; or if no such serializer can be found, a default handler (which may do a best-effort generic serialization or just simply throw an exception when invoked).
    `JsonSerializer<java.lang.Object>` | `findValueSerializer(JavaType valueType)` Method variant used when we do NOT want contextualization to happen; it will need to be handled at a later point, but caller wants to be able to do that as needed; sometimes to avoid infinite loops
    `JsonSerializer<java.lang.Object>` | `findValueSerializer(JavaType valueType, BeanProperty property)` Similar to `findValueSerializer(Class,BeanProperty)`, but takes full generics-aware type instead of raw class.
    `java.lang.Class<?>` | `getActiveView()` Accessor for locating currently active view, if any; returns null if no view has been set.
    `AnnotationIntrospector` | `getAnnotationIntrospector()` Convenience method for accessing serialization view in use (if any); equivalent to:
    `java.lang.Object` | `getAttribute(java.lang.Object key)` Method for accessing attributes available in this context.
    `SerializationConfig` | `getConfig()` Method for accessing configuration for the serialization processing.
    `JsonSerializer<java.lang.Object>` | `getDefaultNullKeySerializer()`
    `JsonSerializer<java.lang.Object>` | `getDefaultNullValueSerializer()`
    `com.fasterxml.jackson.annotation.JsonFormat.Value` | `getDefaultPropertyFormat(java.lang.Class<?> baseType)`
    `com.fasterxml.jackson.annotation.JsonInclude.Value` | `getDefaultPropertyInclusion(java.lang.Class<?> baseType)`
    `FilterProvider` | `getFilterProvider()` Convenience method for accessing provider to find serialization filters used, equivalent to calling:
    `com.fasterxml.jackson.core.JsonGenerator` | `getGenerator()`
    `java.util.Locale` | `getLocale()` Method for accessing default Locale to use: convenience method for
    `java.lang.Class<?>` | `getSerializationView()` Deprecated. Since 2.2, use `getActiveView()` instead.
    `java.util.TimeZone` | `getTimeZone()` Method for accessing default TimeZone to use: convenience method for
    `TypeFactory` | `getTypeFactory()`
    `JsonSerializer<java.lang.Object>` | `getUnknownTypeSerializer(java.lang.Class<?> unknownType)` Method called to get the serializer to use if provider can not determine an actual type-specific serializer to use; typically when none of `SerializerFactory` instances are able to construct a serializer.
    `JsonSerializer<?>` | `handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property)` Method called for primary property serializers (ones directly created to serialize values of a POJO property), to handle details of resolving `ContextualSerializer` with given property context.
    `JsonSerializer<?>` | `handleSecondaryContextualization(JsonSerializer<?> ser, BeanProperty property)` Method called for secondary property serializers (ones NOT directly created to serialize values of a POJO property but instead created as a dependant serializer -- such as value serializers for structured types, or serializers for root values) to handle details of resolving `ContextualDeserializer` with given property context.
    `boolean` | `hasSerializationFeatures(int featureMask)` "Bulk" access method for checking that all features specified by mask are enabled.
    `boolean` | `isEnabled(MapperFeature feature)` Convenience method for checking whether specified serialization feature is enabled or not.
    `boolean` | `isEnabled(SerializationFeature feature)` Convenience method for checking whether specified serialization feature is enabled or not.
    `boolean` | `isUnknownTypeSerializer(JsonSerializer<?> ser)` Helper method called to see if given serializer is considered to be something returned by `getUnknownTypeSerializer(java.lang.Class<?>)`, that is, something for which no regular serializer was found or constructed.
    `JsonMappingException` | `mappingException(java.lang.String message, java.lang.Object... args)` Factory method for constructing a `JsonMappingException`; usually only indirectly used by calling `reportMappingProblem(String, Object...)`.
    `protected JsonMappingException` | `mappingException(java.lang.Throwable t, java.lang.String message, java.lang.Object... args)` Factory method for constructing a `JsonMappingException`; usually only indirectly used by calling `reportMappingProblem(Throwable, String, Object...)`
    `<T> T` | `reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, java.lang.String message, java.lang.Object... args)` Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific property (of a type), unrelated to actual JSON content to map.
    `<T> T` | `reportBadTypeDefinition(BeanDescription bean, java.lang.String message, java.lang.Object... args)` Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map.
    `void` | `reportMappingProblem(java.lang.String message, java.lang.Object... args)` Helper method called to indicate problem; default behavior is to construct and throw a `JsonMappingException`, but in future may collect more than one and only throw after certain number, or at the end of serialization.
    `void` | `reportMappingProblem(java.lang.Throwable t, java.lang.String message, java.lang.Object... args)` Helper method called to indicate problem; default behavior is to construct and throw a `JsonMappingException`, but in future may collect more than one and only throw after certain number, or at the end of serialization.
    `abstract JsonSerializer<java.lang.Object>` | `serializerInstance(Annotated annotated, java.lang.Object serDef)` Method that can be called to construct and configure serializer instance, either given a `Class` to instantiate (with default constructor), or an uninitialized serializer instance.
    `SerializerProvider` | `setAttribute(java.lang.Object key, java.lang.Object value)` Method for setting per-call value of given attribute.
    `void` | `setDefaultKeySerializer(JsonSerializer<java.lang.Object> ks)` Method that can be used to specify serializer that will be used to write JSON property names matching null keys for Java Maps (which will throw an exception if try write such property name)
    `void` | `setNullKeySerializer(JsonSerializer<java.lang.Object> nks)` Method that can be used to specify serializer to use for serializing all non-null JSON property names, unless more specific key serializer is found (i.e.
    `void` | `setNullValueSerializer(JsonSerializer<java.lang.Object> nvs)` Method that can be used to specify serializer that will be used to write JSON values matching Java null values instead of default one (which simply writes JSON null).

    - ### Methods inherited from class com.fasterxml.jackson.databind.DatabindContext

      `constructSpecializedType, constructType, converterInstance, objectIdGeneratorInstance, objectIdResolverInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CACHE_UNKNOWN_MAPPINGS

          protected static final boolean CACHE_UNKNOWN_MAPPINGS

      Setting for determining whether mappings for "unknown classes" should be cached for faster resolution. Usually this isn't needed, but maybe it is in some cases?
      See Also:
        Constant Field Values

    - #### DEFAULT_NULL_KEY_SERIALIZER

          public static final JsonSerializer<java.lang.Object> DEFAULT_NULL_KEY_SERIALIZER

    - #### DEFAULT_UNKNOWN_SERIALIZER

          protected static final JsonSerializer<java.lang.Object> DEFAULT_UNKNOWN_SERIALIZER

      Placeholder serializer used when `java.lang.Object` typed property is marked to be serialized.
      NOTE: starting with 2.6, this instance is NOT used for any other types, and separate instances are constructed for "empty" Beans.

      NOTE: changed to `protected` for 2.3; no need to be publicly available.

    - #### _config

          protected final SerializationConfig _config

      Serialization configuration to use for serialization processing.

    - #### _serializationView

          protected final java.lang.Class<?> _serializationView

      View used for currently active serialization, if any. Only set for non-blueprint instances.

    - #### _serializerFactory

          protected final SerializerFactory _serializerFactory

      Factory used for constructing actual serializer instances. Only set for non-blueprint instances.

    - #### _serializerCache

          protected final SerializerCache _serializerCache

      Cache for doing type-to-value-serializer lookups.

    - #### _attributes

          protected transient ContextAttributes _attributes

      Lazily-constructed holder for per-call attributes. Only set for non-blueprint instances.
      Since:
        2.3

    - #### _unknownTypeSerializer

          protected JsonSerializer<java.lang.Object> _unknownTypeSerializer

      Serializer that gets called for values of types for which no serializers can be constructed.

      The default serializer will simply thrown an exception.

    - #### _keySerializer

          protected JsonSerializer<java.lang.Object> _keySerializer

      Serializer used to output non-null keys of Maps (which will get output as JSON Objects), if not null; if null, us the standard default key serializer.

    - #### _nullValueSerializer

          protected JsonSerializer<java.lang.Object> _nullValueSerializer

      Serializer used to output a null value. Default implementation writes nulls using `JsonGenerator.writeNull()`.

    - #### _nullKeySerializer

          protected JsonSerializer<java.lang.Object> _nullKeySerializer

      Serializer used to (try to) output a null key, due to an entry of `Map` having null key. The default implementation will throw an exception if this happens; alternative implementation (like one that would write an Empty String) can be defined.

    - #### _knownSerializers

          protected final ReadOnlyClassToSerializerMap _knownSerializers

      For fast lookups, we will have a local non-shared read-only map that contains serializers previously fetched.

    - #### _dateFormat

          protected java.text.DateFormat _dateFormat

      Lazily acquired and instantiated formatter object: initialized first time it is needed, reused afterwards. Used via instances (not blueprints), so that access need not be thread-safe.

    - #### _stdNullValueSerializer

          protected final boolean _stdNullValueSerializer

      Flag set to indicate that we are using vanilla null value serialization
      Since:
        2.3

  - ### Constructor Detail

    - #### SerializerProvider

          public SerializerProvider()

      Constructor for creating master (or "blue-print") provider object, which is only used as the template for constructing per-binding instances.

    - #### SerializerProvider

          protected SerializerProvider(SerializerProvider src,
                            SerializationConfig config,
                            SerializerFactory f)

      "Copy-constructor", used by sub-classes when creating actual non-blueprint instances to use.
      Parameters:
        `src` - Blueprint object used as the baseline for this instance

    - #### SerializerProvider

          protected SerializerProvider(SerializerProvider src)

      Copy-constructor used when making a copy of a blueprint instance.
      Since:
        2.5

  - ### Method Detail

    - #### setDefaultKeySerializer

          public void setDefaultKeySerializer(JsonSerializer<java.lang.Object> ks)

      Method that can be used to specify serializer that will be used to write JSON property names matching null keys for Java Maps (which will throw an exception if try write such property name)

    - #### setNullValueSerializer

          public void setNullValueSerializer(JsonSerializer<java.lang.Object> nvs)

      Method that can be used to specify serializer that will be used to write JSON values matching Java null values instead of default one (which simply writes JSON null).

      Note that you can get finer control over serializer to use by overriding `findNullValueSerializer(com.fasterxml.jackson.databind.BeanProperty)`, which gets called once per each property.

    - #### setNullKeySerializer

          public void setNullKeySerializer(JsonSerializer<java.lang.Object> nks)

      Method that can be used to specify serializer to use for serializing all non-null JSON property names, unless more specific key serializer is found (i.e. if not custom key serializer has been registered for Java type).

      Note that key serializer registration are different from value serializer registrations.

    - #### getConfig

          public final SerializationConfig getConfig()

      Method for accessing configuration for the serialization processing.
      Specified by:
        `getConfig` in class `DatabindContext`

    - #### getAnnotationIntrospector

          public final AnnotationIntrospector getAnnotationIntrospector()

      Description copied from class: `DatabindContext`
      Convenience method for accessing serialization view in use (if any); equivalent to:

             getConfig().getAnnotationIntrospector();

      Specified by:
        `getAnnotationIntrospector` in class `DatabindContext`

    - #### getTypeFactory

          public final TypeFactory getTypeFactory()

      Specified by:
        `getTypeFactory` in class `DatabindContext`

    - #### getActiveView

          public final java.lang.Class<?> getActiveView()

      Description copied from class: `DatabindContext`
      Accessor for locating currently active view, if any; returns null if no view has been set.
      Specified by:
        `getActiveView` in class `DatabindContext`

    - #### getSerializationView

          @Deprecated
          public final java.lang.Class<?> getSerializationView()

      Deprecated. Since 2.2, use `getActiveView()` instead.

    - #### canOverrideAccessModifiers

          public final boolean canOverrideAccessModifiers()

      Description copied from class: `DatabindContext`
      Convenience method for accessing serialization view in use (if any); equivalent to:

             getConfig().canOverrideAccessModifiers();

      Specified by:
        `canOverrideAccessModifiers` in class `DatabindContext`

    - #### isEnabled

          public final boolean isEnabled(MapperFeature feature)

      Description copied from class: `DatabindContext`
      Convenience method for checking whether specified serialization feature is enabled or not. Shortcut for:

            getConfig().isEnabled(feature);

      Specified by:
        `isEnabled` in class `DatabindContext`

    - #### getDefaultPropertyFormat

          public final com.fasterxml.jackson.annotation.JsonFormat.Value getDefaultPropertyFormat(java.lang.Class<?> baseType)

      Specified by:
        `getDefaultPropertyFormat` in class `DatabindContext`

    - #### getDefaultPropertyInclusion

          public final com.fasterxml.jackson.annotation.JsonInclude.Value getDefaultPropertyInclusion(java.lang.Class<?> baseType)

      Since:
        2.8

    - #### getLocale

          public java.util.Locale getLocale()

      Method for accessing default Locale to use: convenience method for

             getConfig().getLocale();

      Specified by:
        `getLocale` in class `DatabindContext`

    - #### getTimeZone

          public java.util.TimeZone getTimeZone()

      Method for accessing default TimeZone to use: convenience method for

             getConfig().getTimeZone();

      Specified by:
        `getTimeZone` in class `DatabindContext`

    - #### getAttribute

          public java.lang.Object getAttribute(java.lang.Object key)

      Description copied from class: `DatabindContext`
      Method for accessing attributes available in this context. Per-call attributes have highest precedence; attributes set via `ObjectReader` or `ObjectWriter` have lower precedence.
      Specified by:
        `getAttribute` in class `DatabindContext`
      Parameters:
        `key` - Key of the attribute to get
      Returns:
        Value of the attribute, if any; null otherwise

    - #### setAttribute

          public SerializerProvider setAttribute(java.lang.Object key,
                                        java.lang.Object value)

      Description copied from class: `DatabindContext`
      Method for setting per-call value of given attribute. This will override any previously defined value for the attribute within this context.
      Specified by:
        `setAttribute` in class `DatabindContext`
      Parameters:
        `key` - Key of the attribute to set
        `value` - Value to set attribute to
      Returns:
        This context object, to allow chaining

    - #### isEnabled

          public final boolean isEnabled(SerializationFeature feature)

      Convenience method for checking whether specified serialization feature is enabled or not. Shortcut for:

            getConfig().isEnabled(feature);

    - #### hasSerializationFeatures

          public final boolean hasSerializationFeatures(int featureMask)

      "Bulk" access method for checking that all features specified by mask are enabled.
      Since:
        2.3

    - #### getFilterProvider

          public final FilterProvider getFilterProvider()

      Convenience method for accessing provider to find serialization filters used, equivalent to calling:

             getConfig().getFilterProvider();

    - #### findObjectId

          public abstract WritableObjectId findObjectId(java.lang.Object forPojo,
                                      com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generatorType)

      Method called to find the Object Id for given POJO, if one has been generated. Will always return a non-null Object; contents vary depending on whether an Object Id already exists or not.

    - #### findValueSerializer

          public JsonSerializer<java.lang.Object> findValueSerializer(java.lang.Class<?> valueType,
                                                             BeanProperty property)
                                                               throws JsonMappingException

      Method called to get hold of a serializer for a value of given type; or if no such serializer can be found, a default handler (which may do a best-effort generic serialization or just simply throw an exception when invoked).

      Note: this method is only called for non-null values; not for keys or null values. For these, check out other accessor methods.

      Note that serializers produced should NOT handle polymorphic serialization aspects; separate `TypeSerializer` is to be constructed by caller if and as necessary.

      Throws:
        `JsonMappingException` - if there are fatal problems with accessing suitable serializer; including that of not finding any serializer

    - #### findValueSerializer

          public JsonSerializer<java.lang.Object> findValueSerializer(JavaType valueType,
                                                             BeanProperty property)
                                                               throws JsonMappingException

      Similar to `findValueSerializer(Class,BeanProperty)`, but takes full generics-aware type instead of raw class. This is necessary for accurate handling of external type information, to handle polymorphic types.
      Parameters:
        `property` - When creating secondary serializers, property for which serializer is needed: annotations of the property (or bean that contains it) may be checked to create contextual serializers.
      Throws:
        `JsonMappingException`

    - #### findValueSerializer

          public JsonSerializer<java.lang.Object> findValueSerializer(java.lang.Class<?> valueType)
                                                               throws JsonMappingException

      Method variant used when we do NOT want contextualization to happen; it will need to be handled at a later point, but caller wants to be able to do that as needed; sometimes to avoid infinite loops
      Throws:
        `JsonMappingException`
      Since:
        2.5

    - #### findValueSerializer

          public JsonSerializer<java.lang.Object> findValueSerializer(JavaType valueType)
                                                               throws JsonMappingException

      Method variant used when we do NOT want contextualization to happen; it will need to be handled at a later point, but caller wants to be able to do that as needed; sometimes to avoid infinite loops
      Throws:
        `JsonMappingException`
      Since:
        2.5

    - #### findPrimaryPropertySerializer

          public JsonSerializer<java.lang.Object> findPrimaryPropertySerializer(JavaType valueType,
                                                                       BeanProperty property)
                                                                         throws JsonMappingException

      Similar to `findValueSerializer(JavaType, BeanProperty)`, but used when finding "primary" property value serializer (one directly handling value of the property). Difference has to do with contextual resolution, and method(s) called: this method should only be called when caller is certain that this is the primary property value serializer.
      Parameters:
        `property` - Property that is being handled; will never be null, and its type has to match `valueType` parameter.
      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### findPrimaryPropertySerializer

          public JsonSerializer<java.lang.Object> findPrimaryPropertySerializer(java.lang.Class<?> valueType,
                                                                       BeanProperty property)
                                                                         throws JsonMappingException

      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### findTypedValueSerializer

          public JsonSerializer<java.lang.Object> findTypedValueSerializer(java.lang.Class<?> valueType,
                                                                  boolean cache,
                                                                  BeanProperty property)
                                                                    throws JsonMappingException

      Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence. This method is currently only used for root-level serializer handling to allow for simpler caching. A call can always be replaced by equivalent calls to access serializer and type serializer separately.
      Parameters:
        `valueType` - Type for purpose of locating a serializer; usually dynamic runtime type, but can also be static declared type, depending on configuration
        `cache` - Whether resulting value serializer should be cached or not; this is just a hint
        `property` - When creating secondary serializers, property for which serializer is needed: annotations of the property (or bean that contains it) may be checked to create contextual serializers.
      Throws:
        `JsonMappingException`

    - #### findTypedValueSerializer

          public JsonSerializer<java.lang.Object> findTypedValueSerializer(JavaType valueType,
                                                                  boolean cache,
                                                                  BeanProperty property)
                                                                    throws JsonMappingException

      Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence. This method is currently only used for root-level serializer handling to allow for simpler caching. A call can always be replaced by equivalent calls to access serializer and type serializer separately.
      Parameters:
        `valueType` - Declared type of value being serialized (which may not be actual runtime type); used for finding both value serializer and type serializer to use for adding polymorphic type (if any)
        `cache` - Whether resulting value serializer should be cached or not; this is just a hint
        `property` - When creating secondary serializers, property for which serializer is needed: annotations of the property (or bean that contains it) may be checked to create contextual serializers.
      Throws:
        `JsonMappingException`

    - #### findTypeSerializer

          public TypeSerializer findTypeSerializer(JavaType javaType)
                                            throws JsonMappingException

      Method called to get the `TypeSerializer` to use for including Type Id necessary for serializing for the given Java class. Useful for schema generators.
      Throws:
        `JsonMappingException`
      Since:
        2.6

    - #### findKeySerializer

          public JsonSerializer<java.lang.Object> findKeySerializer(JavaType keyType,
                                                           BeanProperty property)
                                                             throws JsonMappingException

      Method called to get the serializer to use for serializing non-null Map keys. Separation from regular `findValueSerializer(java.lang.Class<?>, com.fasterxml.jackson.databind.BeanProperty)` method is because actual write method must be different (@link JsonGenerator#writeFieldName}; but also since behavior for some key types may differ.

      Note that the serializer itself can be called with instances of any Java object, but not nulls.

      Throws:
        `JsonMappingException`

    - #### findKeySerializer

          public JsonSerializer<java.lang.Object> findKeySerializer(java.lang.Class<?> rawKeyType,
                                                           BeanProperty property)
                                                             throws JsonMappingException

      Throws:
        `JsonMappingException`
      Since:
        2.7

    - #### getDefaultNullKeySerializer

          public JsonSerializer<java.lang.Object> getDefaultNullKeySerializer()

      Since:
        2.0

    - #### getDefaultNullValueSerializer

          public JsonSerializer<java.lang.Object> getDefaultNullValueSerializer()

      Since:
        2.0

    - #### findNullKeySerializer

          public JsonSerializer<java.lang.Object> findNullKeySerializer(JavaType serializationType,
                                                               BeanProperty property)
                                                                 throws JsonMappingException

      Method called to find a serializer to use for null values for given declared type. Note that type is completely based on declared type, since nulls in Java have no type and thus runtime type can not be determined.
      Throws:
        `JsonMappingException`
      Since:
        2.0

    - #### findNullValueSerializer

          public JsonSerializer<java.lang.Object> findNullValueSerializer(BeanProperty property)
                                                                   throws JsonMappingException

      Method called to get the serializer to use for serializing null values for specified property.

      Default implementation simply calls `getDefaultNullValueSerializer()`; can be overridden to add custom null serialization for properties of certain type or name. This gives method full granularity to basically override null handling for any specific property or class of properties.

      Throws:
        `JsonMappingException`
      Since:
        2.0

    - #### getUnknownTypeSerializer

          public JsonSerializer<java.lang.Object> getUnknownTypeSerializer(java.lang.Class<?> unknownType)

      Method called to get the serializer to use if provider can not determine an actual type-specific serializer to use; typically when none of `SerializerFactory` instances are able to construct a serializer.

      Typically, returned serializer will throw an exception, although alternatively `ToStringSerializer` could be returned as well.

      Parameters:
        `unknownType` - Type for which no serializer is found

    - #### isUnknownTypeSerializer

          public boolean isUnknownTypeSerializer(JsonSerializer<?> ser)

      Helper method called to see if given serializer is considered to be something returned by `getUnknownTypeSerializer(java.lang.Class<?>)`, that is, something for which no regular serializer was found or constructed.
      Since:
        2.5

    - #### serializerInstance

          public abstract JsonSerializer<java.lang.Object> serializerInstance(Annotated annotated,
                                                            java.lang.Object serDef)
                                                                       throws JsonMappingException

      Method that can be called to construct and configure serializer instance, either given a `Class` to instantiate (with default constructor), or an uninitialized serializer instance. Either way, serialize will be properly resolved (via `ResolvableSerializer`) and/or contextualized (via `ContextualSerializer`) as necessary.
      Parameters:
        `annotated` - Annotated entity that contained definition
        `serDef` - Serializer definition: either an instance or class
      Throws:
        `JsonMappingException`

    - #### handlePrimaryContextualization

          public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser,
                                                         BeanProperty property)
                                                           throws JsonMappingException

      Method called for primary property serializers (ones directly created to serialize values of a POJO property), to handle details of resolving `ContextualSerializer` with given property context.
      Parameters:
        `property` - Property for which the given primary serializer is used; never null.
      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### handleSecondaryContextualization

          public JsonSerializer<?> handleSecondaryContextualization(JsonSerializer<?> ser,
                                                           BeanProperty property)
                                                             throws JsonMappingException

      Method called for secondary property serializers (ones NOT directly created to serialize values of a POJO property but instead created as a dependant serializer -- such as value serializers for structured types, or serializers for root values) to handle details of resolving `ContextualDeserializer` with given property context. Given that these serializers are not directly related to given property (or, in case of root value property, to any property), annotations accessible may or may not be relevant.
      Parameters:
        `property` - Property for which serializer is used, if any; null when deserializing root values
      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### defaultSerializeValue

          public final void defaultSerializeValue(java.lang.Object value,
                                   com.fasterxml.jackson.core.JsonGenerator gen)
                                           throws java.io.IOException

      Convenience method that will serialize given value (which can be null) using standard serializer locating functionality. It can be called for all values including field and Map values, but usually field values are best handled calling `defaultSerializeField(java.lang.String, java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)` instead.
      Throws:
        `java.io.IOException`

    - #### defaultSerializeField

          public final void defaultSerializeField(java.lang.String fieldName,
                                   java.lang.Object value,
                                   com.fasterxml.jackson.core.JsonGenerator gen)
                                           throws java.io.IOException

      Convenience method that will serialize given field with specified value. Value may be null. Serializer is done using the usual null) using standard serializer locating functionality.
      Throws:
        `java.io.IOException`

    - #### defaultSerializeDateValue

          public final void defaultSerializeDateValue(long timestamp,
                                       com.fasterxml.jackson.core.JsonGenerator gen)
                                               throws java.io.IOException

      Method that will handle serialization of Date(-like) values, using `SerializationConfig` settings to determine expected serialization behavior. Note: date here means "full" date, that is, date AND time, as per Java convention (and not date-only values like in SQL)
      Throws:
        `java.io.IOException`

    - #### defaultSerializeDateValue

          public final void defaultSerializeDateValue(java.util.Date date,
                                       com.fasterxml.jackson.core.JsonGenerator gen)
                                               throws java.io.IOException

      Method that will handle serialization of Date(-like) values, using `SerializationConfig` settings to determine expected serialization behavior. Note: date here means "full" date, that is, date AND time, as per Java convention (and not date-only values like in SQL)
      Throws:
        `java.io.IOException`

    - #### defaultSerializeDateKey

          public void defaultSerializeDateKey(long timestamp,
                                     com.fasterxml.jackson.core.JsonGenerator gen)
                                       throws java.io.IOException

      Method that will handle serialization of Dates used as `Map` keys, based on `SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS` value (and if using textual representation, configured date format)
      Throws:
        `java.io.IOException`

    - #### defaultSerializeDateKey

          public void defaultSerializeDateKey(java.util.Date date,
                                     com.fasterxml.jackson.core.JsonGenerator gen)
                                       throws java.io.IOException

      Method that will handle serialization of Dates used as `Map` keys, based on `SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS` value (and if using textual representation, configured date format)
      Throws:
        `java.io.IOException`

    - #### defaultSerializeNull

          public final void defaultSerializeNull(com.fasterxml.jackson.core.JsonGenerator gen)
                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### mappingException

          public JsonMappingException mappingException(java.lang.String message,
                                              java.lang.Object... args)

      Factory method for constructing a `JsonMappingException`; usually only indirectly used by calling `reportMappingProblem(String, Object...)`.
      Since:
        2.6

    - #### mappingException

          protected JsonMappingException mappingException(java.lang.Throwable t,
                                              java.lang.String message,
                                              java.lang.Object... args)

      Factory method for constructing a `JsonMappingException`; usually only indirectly used by calling `reportMappingProblem(Throwable, String, Object...)`
      Since:
        2.8

    - #### reportMappingProblem

          public void reportMappingProblem(java.lang.String message,
                                  java.lang.Object... args)
                                    throws JsonMappingException

      Helper method called to indicate problem; default behavior is to construct and throw a `JsonMappingException`, but in future may collect more than one and only throw after certain number, or at the end of serialization.
      Throws:
        `JsonMappingException`
      Since:
        2.8

    - #### reportMappingProblem

          public void reportMappingProblem(java.lang.Throwable t,
                                  java.lang.String message,
                                  java.lang.Object... args)
                                    throws JsonMappingException

      Helper method called to indicate problem; default behavior is to construct and throw a `JsonMappingException`, but in future may collect more than one and only throw after certain number, or at the end of serialization.
      Throws:
        `JsonMappingException`
      Since:
        2.8

    - #### reportBadTypeDefinition

          public <T> T reportBadTypeDefinition(BeanDescription bean,
                                      java.lang.String message,
                                      java.lang.Object... args)
                                    throws JsonMappingException

      Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map. Default behavior is to construct and throw a `JsonMappingException`.
      Throws:
        `JsonMappingException`
      Since:
        2.9

    - #### reportBadPropertyDefinition

          public <T> T reportBadPropertyDefinition(BeanDescription bean,
                                          BeanPropertyDefinition prop,
                                          java.lang.String message,
                                          java.lang.Object... args)
                                        throws JsonMappingException

      Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific property (of a type), unrelated to actual JSON content to map. Default behavior is to construct and throw a `JsonMappingException`.
      Throws:
        `JsonMappingException`
      Since:
        2.9

    - #### getGenerator

          public com.fasterxml.jackson.core.JsonGenerator getGenerator()

      Since:
        2.8

    - #### _reportIncompatibleRootType

          protected void _reportIncompatibleRootType(java.lang.Object value,
                                         JavaType rootType)
                                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### _findExplicitUntypedSerializer

          protected JsonSerializer<java.lang.Object> _findExplicitUntypedSerializer(java.lang.Class<?> runtimeType)
                                                                             throws JsonMappingException

      Method that will try to find a serializer, either from cache or by constructing one; but will not return an "unknown" serializer if this can not be done but rather returns null.
      Returns:
        Serializer if one can be found, null if not.
      Throws:
        `JsonMappingException`

    - #### _createAndCacheUntypedSerializer

          protected JsonSerializer<java.lang.Object> _createAndCacheUntypedSerializer(java.lang.Class<?> rawType)
                                                                               throws JsonMappingException

      Method that will try to construct a value serializer; and if one is successfully created, cache it for reuse.
      Throws:
        `JsonMappingException`

    - #### _createAndCacheUntypedSerializer

          protected JsonSerializer<java.lang.Object> _createAndCacheUntypedSerializer(JavaType type)
                                                                               throws JsonMappingException

      Throws:
        `JsonMappingException`

    - #### _createUntypedSerializer

          protected JsonSerializer<java.lang.Object> _createUntypedSerializer(JavaType type)
                                                                       throws JsonMappingException

      Throws:
        `JsonMappingException`
      Since:
        2.1

    - #### _handleContextualResolvable

          protected JsonSerializer<java.lang.Object> _handleContextualResolvable(JsonSerializer<?> ser,
                                                                     BeanProperty property)
                                                                          throws JsonMappingException

      Helper method called to resolve and contextualize given serializer, if and as necessary.
      Throws:
        `JsonMappingException`

    - #### _handleResolvable

          protected JsonSerializer<java.lang.Object> _handleResolvable(JsonSerializer<?> ser)
                                                                throws JsonMappingException

      Throws:
        `JsonMappingException`

    - #### _desc

          protected java.lang.String _desc(java.lang.Object value)

    - #### _quotedString

          protected java.lang.String _quotedString(java.lang.Object value)

    - #### _dateFormat

          protected final java.text.DateFormat _dateFormat()