public abstract class SerializerProvider extends DatabindContext
ObjectMapper and
JsonSerializers 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.
| 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 DateFormat |
_dateFormat
Lazily acquired and instantiated formatter object: initialized
first time it is needed, reused afterwards.
|
protected JsonSerializer<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<Object> |
_nullKeySerializer
Serializer used to (try to) output a null key, due to an entry of
Map having null key. |
protected JsonSerializer<Object> |
_nullValueSerializer
Serializer used to output a null value.
|
protected 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<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<Object> |
DEFAULT_NULL_KEY_SERIALIZER |
protected static JsonSerializer<Object> |
DEFAULT_UNKNOWN_SERIALIZER
Placeholder serializer used when
java.lang.Object typed property
is marked to be serialized. |
| 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.
|
| Modifier and Type | Method and Description |
|---|---|
protected JsonSerializer<Object> |
_createAndCacheUntypedSerializer(Class<?> rawType)
Method that will try to construct a value serializer; and if
one is successfully created, cache it for reuse.
|
protected JsonSerializer<Object> |
_createAndCacheUntypedSerializer(JavaType type) |
protected JsonSerializer<Object> |
_createUntypedSerializer(JavaType type) |
protected DateFormat |
_dateFormat() |
protected JsonSerializer<Object> |
_findExplicitUntypedSerializer(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 cannot be done but rather returns null.
|
protected JsonSerializer<Object> |
_handleContextualResolvable(JsonSerializer<?> ser,
BeanProperty property)
Helper method called to resolve and contextualize given
serializer, if and as necessary.
|
protected JsonSerializer<Object> |
_handleResolvable(JsonSerializer<?> ser) |
protected void |
_reportIncompatibleRootType(Object value,
JavaType rootType) |
boolean |
canOverrideAccessModifiers()
Convenience method for accessing serialization view in use (if any); equivalent to:
|
JavaType |
constructSpecializedType(JavaType baseType,
Class<?> subclass)
Convenience method for constructing subtypes, retaining generic
type parameter (if any).
|
void |
defaultSerializeDateKey(Date date,
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,
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(Date date,
JsonGenerator gen)
Method that will handle serialization of Date(-like) values, using
SerializationConfig settings to determine expected serialization
behavior. |
void |
defaultSerializeDateValue(long timestamp,
JsonGenerator gen)
Method that will handle serialization of Date(-like) values, using
SerializationConfig settings to determine expected serialization
behavior. |
void |
defaultSerializeField(String fieldName,
Object value,
JsonGenerator gen)
Convenience method that will serialize given field with specified
value.
|
void |
defaultSerializeNull(JsonGenerator gen) |
void |
defaultSerializeValue(Object value,
JsonGenerator gen)
Convenience method that will serialize given value (which can be
null) using standard serializer locating functionality.
|
JsonSerializer<Object> |
findContentValueSerializer(Class<?> valueType,
BeanProperty property)
|
JsonSerializer<Object> |
findContentValueSerializer(JavaType valueType,
BeanProperty property)
Alternative to
findPrimaryPropertySerializer(JavaType, BeanProperty) called not
for primary value, but "content" of such primary serializer: element of an array or
Collection, value of Map entry and so on. |
JsonSerializer<Object> |
findKeySerializer(Class<?> rawKeyType,
BeanProperty property) |
JsonSerializer<Object> |
findKeySerializer(JavaType keyType,
BeanProperty property)
Method called to get the serializer to use for serializing
non-null Map keys.
|
JsonSerializer<Object> |
findNullKeySerializer(JavaType serializationType,
BeanProperty property)
Method called to find a serializer to use for null values for given
declared type.
|
JsonSerializer<Object> |
findNullValueSerializer(BeanProperty property)
Method called to get the serializer to use for serializing null
values for specified property.
|
abstract WritableObjectId |
findObjectId(Object forPojo,
ObjectIdGenerator<?> generatorType)
Method called to find the Object Id for given POJO, if one
has been generated.
|
JsonSerializer<Object> |
findPrimaryPropertySerializer(Class<?> valueType,
BeanProperty property)
|
JsonSerializer<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<Object> |
findTypedValueSerializer(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<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<Object> |
findValueSerializer(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<Object> |
findValueSerializer(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<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<Object> |
findValueSerializer(JavaType valueType,
BeanProperty property)
Similar to
findValueSerializer(Class,BeanProperty), but takes
full generics-aware type instead of raw class. |
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:
|
Object |
getAttribute(Object key)
Method for accessing attributes available in this context.
|
SerializationConfig |
getConfig()
Method for accessing configuration for the serialization processing.
|
JsonSerializer<Object> |
getDefaultNullKeySerializer() |
JsonSerializer<Object> |
getDefaultNullValueSerializer() |
JsonFormat.Value |
getDefaultPropertyFormat(Class<?> baseType) |
JsonInclude.Value |
getDefaultPropertyInclusion(Class<?> baseType) |
FilterProvider |
getFilterProvider()
Convenience method for accessing provider to find serialization filters used,
equivalent to calling:
|
JsonGenerator |
getGenerator()
NOTE: current implementation simply returns `null` as generator is not yet
assigned to this provider.
|
Locale |
getLocale()
Method for accessing default Locale to use: convenience method for
|
Class<?> |
getSerializationView()
Deprecated.
Since 2.2, use
getActiveView() instead. |
TimeZone |
getTimeZone()
Method for accessing default TimeZone to use: convenience method for
|
TypeFactory |
getTypeFactory() |
JsonSerializer<Object> |
getUnknownTypeSerializer(Class<?> unknownType)
Method called to get the serializer to use if provider
cannot 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.
|
abstract Object |
includeFilterInstance(BeanPropertyDefinition forProperty,
Class<?> filterClass)
Method that can be called to construct and configure
JsonInclude
filter instance,
given a Class to instantiate (with default constructor, by default). |
abstract boolean |
includeFilterSuppressNulls(Object filter)
Follow-up method that may be called after calling
includeFilterInstance(com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition, java.lang.Class<?>),
to check handling of `null` values by the filter. |
JsonMappingException |
invalidTypeIdException(JavaType baseType,
String typeId,
String extraDesc)
Helper method for constructing exception to indicate that given type id
could not be resolved to a valid subtype of specified base type.
|
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(String message,
Object... msgArgs)
Deprecated.
Since 2.9
|
protected JsonMappingException |
mappingException(Throwable t,
String message,
Object... msgArgs)
Deprecated.
Since 2.9
|
<T> T |
reportBadDefinition(Class<?> raw,
String msg,
Throwable cause) |
<T> T |
reportBadDefinition(JavaType type,
String msg)
Helper method called to indicate a generic problem that stems from type
definition(s), not input data, or input/output state; typically this
means throwing a
InvalidDefinitionException. |
<T> T |
reportBadDefinition(JavaType type,
String msg,
Throwable cause) |
<T> T |
reportBadPropertyDefinition(BeanDescription bean,
BeanPropertyDefinition prop,
String message,
Object... msgArgs)
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,
String msg,
Object... msgArgs)
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(String message,
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(Throwable t,
String message,
Object... msgArgs)
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<Object> |
serializerInstance(Annotated annotated,
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(Object key,
Object value)
Method for setting per-call value of given attribute.
|
void |
setDefaultKeySerializer(JsonSerializer<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<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<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).
|
_colonConcat, _desc, _format, _quotedString, _throwNotASubtype, _throwSubtypeClassNotAllowed, _throwSubtypeNameNotAllowed, _truncate, constructType, converterInstance, objectIdGeneratorInstance, objectIdResolverInstance, reportBadDefinition, resolveAndValidateSubType, resolveSubTypeprotected static final boolean CACHE_UNKNOWN_MAPPINGS
public static final JsonSerializer<Object> DEFAULT_NULL_KEY_SERIALIZER
protected static final JsonSerializer<Object> DEFAULT_UNKNOWN_SERIALIZER
java.lang.Object typed property
is marked to be serialized.
NOTE: changed to protected for 2.3; no need to be publicly available.
protected final SerializationConfig _config
protected final Class<?> _serializationView
protected final SerializerFactory _serializerFactory
protected final SerializerCache _serializerCache
protected transient ContextAttributes _attributes
protected JsonSerializer<Object> _unknownTypeSerializer
The default serializer will simply thrown an exception.
protected JsonSerializer<Object> _keySerializer
protected JsonSerializer<Object> _nullValueSerializer
JsonGenerator.writeNull().protected JsonSerializer<Object> _nullKeySerializer
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.protected final ReadOnlyClassToSerializerMap _knownSerializers
protected DateFormat _dateFormat
protected final boolean _stdNullValueSerializer
public SerializerProvider()
protected SerializerProvider(SerializerProvider src, SerializationConfig config, SerializerFactory f)
src - Blueprint object used as the baseline for this instanceprotected SerializerProvider(SerializerProvider src)
public void setDefaultKeySerializer(JsonSerializer<Object> ks)
public void setNullValueSerializer(JsonSerializer<Object> nvs)
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.
public void setNullKeySerializer(JsonSerializer<Object> nks)
Note that key serializer registration are different from value serializer registrations.
public final SerializationConfig getConfig()
getConfig in class DatabindContextpublic final AnnotationIntrospector getAnnotationIntrospector()
DatabindContextgetConfig().getAnnotationIntrospector();
getAnnotationIntrospector in class DatabindContextpublic final TypeFactory getTypeFactory()
getTypeFactory in class DatabindContextpublic JavaType constructSpecializedType(JavaType baseType, Class<?> subclass) throws IllegalArgumentException
DatabindContextNote: since 2.11 handling has varied a bit across serialization, deserialization.
constructSpecializedType in class DatabindContextIllegalArgumentExceptionpublic final Class<?> getActiveView()
DatabindContextgetActiveView in class DatabindContext@Deprecated public final Class<?> getSerializationView()
getActiveView() instead.public final boolean canOverrideAccessModifiers()
DatabindContextgetConfig().canOverrideAccessModifiers();
canOverrideAccessModifiers in class DatabindContextpublic final boolean isEnabled(MapperFeature feature)
DatabindContextgetConfig().isEnabled(feature);
isEnabled in class DatabindContextpublic final JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
getDefaultPropertyFormat in class DatabindContextpublic final JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType)
public Locale getLocale()
getConfig().getLocale();
getLocale in class DatabindContextpublic TimeZone getTimeZone()
getConfig().getTimeZone();
getTimeZone in class DatabindContextpublic Object getAttribute(Object key)
DatabindContextObjectReader or ObjectWriter have lower
precedence.getAttribute in class DatabindContextkey - Key of the attribute to getpublic SerializerProvider setAttribute(Object key, Object value)
DatabindContextsetAttribute in class DatabindContextkey - Key of the attribute to setvalue - Value to set attribute topublic final boolean isEnabled(SerializationFeature feature)
getConfig().isEnabled(feature);
public final boolean hasSerializationFeatures(int featureMask)
public final FilterProvider getFilterProvider()
getConfig().getFilterProvider();
public JsonGenerator getGenerator()
NOTE: current implementation simply returns `null` as generator is not yet assigned to this provider.
public abstract WritableObjectId findObjectId(Object forPojo, ObjectIdGenerator<?> generatorType)
public JsonSerializer<Object> findValueSerializer(Class<?> valueType, BeanProperty property) throws JsonMappingException
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.
JsonMappingException - if there are fatal problems with
accessing suitable serializer; including that of not
finding any serializerpublic JsonSerializer<Object> findValueSerializer(JavaType valueType, BeanProperty property) throws JsonMappingException
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.
Note: this call will also contextualize serializer before returning it.
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.JsonMappingExceptionpublic JsonSerializer<Object> findValueSerializer(Class<?> valueType) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> findValueSerializer(JavaType valueType) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> findPrimaryPropertySerializer(JavaType valueType, BeanProperty property) throws JsonMappingException
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.valueType - Type of values to serializeproperty - Property that is being handled; will never be null, and its
type has to match valueType parameter.JsonMappingExceptionpublic JsonSerializer<Object> findPrimaryPropertySerializer(Class<?> valueType, BeanProperty property) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> findContentValueSerializer(JavaType valueType, BeanProperty property) throws JsonMappingException
findPrimaryPropertySerializer(JavaType, BeanProperty) called not
for primary value, but "content" of such primary serializer: element of an array or
Collection, value of Map entry and so on.
This means that property passed (if any) does NOT represent value for which
serializer is requested but its secondary type (or secondary type of that type,
recursively).
Serializer returned SHOULD NOT handle type information; caller will (have to) add suitable wrapping if necessary.
Note: this call will also contextualize serializer (call createContextual()
before returning it, if applicable (implements ContextualSerializer)
valueType - Type of values to serializeproperty - Property that indirectly refers to value being serialized (optional,
may be null for root level serializers)JsonMappingExceptionpublic JsonSerializer<Object> findContentValueSerializer(Class<?> valueType, BeanProperty property) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> findTypedValueSerializer(Class<?> valueType, boolean cache, BeanProperty property) throws JsonMappingException
valueType - Type for purpose of locating a serializer; usually dynamic
runtime type, but can also be static declared type, depending on configurationcache - Whether resulting value serializer should be cached or not; this is just
a hintproperty - 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.JsonMappingExceptionpublic JsonSerializer<Object> findTypedValueSerializer(JavaType valueType, boolean cache, BeanProperty property) throws JsonMappingException
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 hintproperty - 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.JsonMappingExceptionpublic TypeSerializer findTypeSerializer(JavaType javaType) throws JsonMappingException
TypeSerializer to use for including Type Id necessary
for serializing for the given Java class.
Useful for schema generators.JsonMappingExceptionpublic JsonSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty property) throws JsonMappingException
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.
JsonMappingExceptionpublic JsonSerializer<Object> findKeySerializer(Class<?> rawKeyType, BeanProperty property) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> getDefaultNullKeySerializer()
public JsonSerializer<Object> getDefaultNullValueSerializer()
public JsonSerializer<Object> findNullKeySerializer(JavaType serializationType, BeanProperty property) throws JsonMappingException
JsonMappingExceptionpublic JsonSerializer<Object> findNullValueSerializer(BeanProperty property) throws JsonMappingException
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.
JsonMappingExceptionpublic JsonSerializer<Object> getUnknownTypeSerializer(Class<?> unknownType)
SerializerFactory
instances are able to construct a serializer.
Typically, returned serializer will throw an exception,
although alternatively ToStringSerializer
could be returned as well.
unknownType - Type for which no serializer is foundpublic boolean isUnknownTypeSerializer(JsonSerializer<?> ser)
getUnknownTypeSerializer(java.lang.Class<?>), that is, something
for which no regular serializer was found or constructed.public abstract JsonSerializer<Object> serializerInstance(Annotated annotated, Object serDef) throws JsonMappingException
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.annotated - Annotated entity that contained definitionserDef - Serializer definition: either an instance or classJsonMappingExceptionpublic abstract Object includeFilterInstance(BeanPropertyDefinition forProperty, Class<?> filterClass) throws JsonMappingException
JsonInclude
filter instance,
given a Class to instantiate (with default constructor, by default).forProperty - (optional) If filter is created for a property, that property;
`null` if filter created via defaulting, global or per-type.JsonMappingExceptionpublic abstract boolean includeFilterSuppressNulls(Object filter) throws JsonMappingException
includeFilterInstance(com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition, java.lang.Class<?>),
to check handling of `null` values by the filter.JsonMappingExceptionpublic JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException
ContextualSerializer with given property context.property - Property for which the given primary serializer is used; never null.JsonMappingExceptionpublic JsonSerializer<?> handleSecondaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException
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.property - Property for which serializer is used, if any; null
when deserializing root valuesJsonMappingExceptionpublic final void defaultSerializeValue(Object value, JsonGenerator gen) throws IOException
defaultSerializeField(java.lang.String, java.lang.Object, com.fasterxml.jackson.core.JsonGenerator) instead.IOExceptionpublic final void defaultSerializeField(String fieldName, Object value, JsonGenerator gen) throws IOException
IOExceptionpublic final void defaultSerializeDateValue(long timestamp,
JsonGenerator gen)
throws IOException
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)IOExceptionpublic final void defaultSerializeDateValue(Date date, JsonGenerator gen) throws IOException
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)IOExceptionpublic void defaultSerializeDateKey(long timestamp,
JsonGenerator gen)
throws IOException
Map keys,
based on SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS
value (and if using textual representation, configured date format)IOExceptionpublic void defaultSerializeDateKey(Date date, JsonGenerator gen) throws IOException
Map keys,
based on SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS
value (and if using textual representation, configured date format)IOExceptionpublic final void defaultSerializeNull(JsonGenerator gen) throws IOException
IOExceptionpublic void reportMappingProblem(String message, Object... args) throws JsonMappingException
JsonMappingException, but in future may collect more than one
and only throw after certain number, or at the end of serialization.JsonMappingExceptionpublic <T> T reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs) throws JsonMappingException
JsonMappingException.JsonMappingExceptionpublic <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String message, Object... msgArgs) throws JsonMappingException
JsonMappingException.JsonMappingExceptionpublic <T> T reportBadDefinition(JavaType type, String msg) throws JsonMappingException
DatabindContextInvalidDefinitionException.reportBadDefinition in class DatabindContextJsonMappingExceptionpublic <T> T reportBadDefinition(JavaType type, String msg, Throwable cause) throws JsonMappingException
JsonMappingExceptionpublic <T> T reportBadDefinition(Class<?> raw, String msg, Throwable cause) throws JsonMappingException
JsonMappingExceptionpublic void reportMappingProblem(Throwable t, String message, Object... msgArgs) throws JsonMappingException
JsonMappingException, but in future may collect more than one
and only throw after certain number, or at the end of serialization.JsonMappingExceptionpublic JsonMappingException invalidTypeIdException(JavaType baseType, String typeId, String extraDesc)
DatabindContext
Note that most of the time this method should NOT be called directly: instead,
method handleUnknownTypeId() should be called which will call this method
if necessary.
invalidTypeIdException in class DatabindContext@Deprecated public JsonMappingException mappingException(String message, Object... msgArgs)
JsonMappingException;
usually only indirectly used by calling
reportMappingProblem(String, Object...).@Deprecated protected JsonMappingException mappingException(Throwable t, String message, Object... msgArgs)
JsonMappingException;
usually only indirectly used by calling
reportMappingProblem(Throwable, String, Object...)protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException
IOExceptionprotected JsonSerializer<Object> _findExplicitUntypedSerializer(Class<?> runtimeType) throws JsonMappingException
JsonMappingExceptionprotected JsonSerializer<Object> _createAndCacheUntypedSerializer(Class<?> rawType) throws JsonMappingException
JsonMappingExceptionprotected JsonSerializer<Object> _createAndCacheUntypedSerializer(JavaType type) throws JsonMappingException
JsonMappingExceptionprotected JsonSerializer<Object> _createUntypedSerializer(JavaType type) throws JsonMappingException
JsonMappingExceptionprotected JsonSerializer<Object> _handleContextualResolvable(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException
JsonMappingExceptionprotected JsonSerializer<Object> _handleResolvable(JsonSerializer<?> ser) throws JsonMappingException
JsonMappingExceptionprotected final DateFormat _dateFormat()
Copyright © 2008–2020 FasterXML. All rights reserved.