java.lang.Object
tools.jackson.databind.ser.impl.PropertySerializerMap
- All Implemented Interfaces:
Serializable
Helper container used for resolving serializers for dynamic (possibly but not
necessarily polymorphic) properties: properties whose type is not forced
to use dynamic (declared) type and that are not final.
If so, serializer to use can only be established once actual value type is known.
Since this happens a lot unless static typing is forced (or types are final)
this implementation is optimized for efficiency.
Instances are immutable; new instances are created with factory methods: this
is important to ensure correct multi-threaded access.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Value class used for returning tuple that has both serializer that was retrieved and new map instance -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
Configuration setting that determines what happens when maximum size (currently 8) is reached: if true, will "start from beginning"; if false, will simply stop adding new entries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSerializer
(Class<?> type, ValueSerializer<Object> serializer) Method that can be used to 'register' a serializer that caller has resolved without help of this map.addSerializer
(JavaType type, ValueSerializer<Object> serializer) static PropertySerializerMap
static PropertySerializerMap
findAndAddKeySerializer
(Class<?> type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a key serializer (possible attached indirectly to a property) Will both find serializer and construct new map instance if warranted, and return both.findAndAddPrimarySerializer
(JavaType type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a primary serializer (one that is directly attached to a property).findAndAddRootValueSerializer
(Class<?> type, SerializationContext provider) Method called if initial lookup fails, when looking for a root value serializer: one that is not directly attached to a property, but needs to haveTypeSerializer
wrapped around it.findAndAddRootValueSerializer
(JavaType type, SerializationContext provider) findAndAddSecondarySerializer
(Class<?> type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a non-primary serializer (one that is not directly attached to a property).findAndAddSecondarySerializer
(Class<?> type, SerializationContext provider, BeanProperty property, UnaryOperator<ValueSerializer<Object>> serTransformer) findAndAddSecondarySerializer
(JavaType type, SerializationContext provider, BeanProperty property) findAndAddSecondarySerializer
(JavaType type, SerializationContext provider, BeanProperty property, UnaryOperator<ValueSerializer<Object>> serTransformer) abstract PropertySerializerMap
newWith
(Class<?> type, ValueSerializer<Object> serializer) abstract ValueSerializer<Object>
serializerFor
(Class<?> type) Main lookup method.
-
Field Details
-
_resetWhenFull
protected final boolean _resetWhenFullConfiguration setting that determines what happens when maximum size (currently 8) is reached: if true, will "start from beginning"; if false, will simply stop adding new entries.
-
-
Constructor Details
-
PropertySerializerMap
protected PropertySerializerMap(boolean resetWhenFull) -
PropertySerializerMap
-
-
Method Details
-
serializerFor
Main lookup method. Takes a "raw" type since usage is always from place where parameterization is fixed such that there cannot be type-parametric variations. -
findAndAddPrimarySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddPrimarySerializer(JavaType type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a primary serializer (one that is directly attached to a property). Will both find serializer and construct new map instance if warranted, and return both. -
findAndAddSecondarySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(Class<?> type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a non-primary serializer (one that is not directly attached to a property). Will both find serializer and construct new map instance if warranted, and return both. -
findAndAddSecondarySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(JavaType type, SerializationContext provider, BeanProperty property) -
findAndAddSecondarySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(Class<?> type, SerializationContext provider, BeanProperty property, UnaryOperator<ValueSerializer<Object>> serTransformer) -
findAndAddSecondarySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(JavaType type, SerializationContext provider, BeanProperty property, UnaryOperator<ValueSerializer<Object>> serTransformer) -
findAndAddRootValueSerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddRootValueSerializer(Class<?> type, SerializationContext provider) Method called if initial lookup fails, when looking for a root value serializer: one that is not directly attached to a property, but needs to haveTypeSerializer
wrapped around it. Will both find the serializer and construct new map instance if warranted, and return both. -
findAndAddRootValueSerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddRootValueSerializer(JavaType type, SerializationContext provider) -
findAndAddKeySerializer
public final PropertySerializerMap.SerializerAndMapResult findAndAddKeySerializer(Class<?> type, SerializationContext provider, BeanProperty property) Method called if initial lookup fails, when looking for a key serializer (possible attached indirectly to a property) Will both find serializer and construct new map instance if warranted, and return both. -
addSerializer
public final PropertySerializerMap.SerializerAndMapResult addSerializer(Class<?> type, ValueSerializer<Object> serializer) Method that can be used to 'register' a serializer that caller has resolved without help of this map. -
addSerializer
public final PropertySerializerMap.SerializerAndMapResult addSerializer(JavaType type, ValueSerializer<Object> serializer) -
newWith
-
emptyForProperties
-
emptyForRootValues
-