T
- Type of serializer to contextualizepublic interface ContextualSerializer<T>
JsonSerializer
s can implement to get a callback
that can be used to create contextual instances of serializer to use for
handling properties of supported type. This can be useful
for serializers that can be configured by annotations, or should otherwise
have differing behavior depending on what kind of property is being serialized.Modifier and Type | Method and Description |
---|---|
JsonSerializer<T> |
createContextual(SerializationConfig config,
BeanProperty property)
Method called to see if a different (or differently configured) serializer
is needed to serialize values of specified property.
|
JsonSerializer<T> createContextual(SerializationConfig config, BeanProperty property) throws JsonMappingException
config
- Current serialization configurationproperty
- Method or field that represents the property
(and is used to access value to serialize).
Should be available; but there may be cases where caller can not provide it and
null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingException