public interface Jackson2JavaTypeMapper extends ClassMapper
Modifier and Type | Interface and Description |
---|---|
static class |
Jackson2JavaTypeMapper.TypePrecedence
The precedence for type conversion - inferred from the method parameter or message
headers.
|
Modifier and Type | Method and Description |
---|---|
void |
addTrustedPackages(java.lang.String... packages) |
void |
fromJavaType(com.fasterxml.jackson.databind.JavaType javaType,
org.apache.kafka.common.header.Headers headers) |
Jackson2JavaTypeMapper.TypePrecedence |
getTypePrecedence() |
default void |
removeHeaders(org.apache.kafka.common.header.Headers headers)
Remove the type information headers.
|
default void |
setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence typePrecedence)
Set the precedence for evaluating type information in message properties.
|
com.fasterxml.jackson.databind.JavaType |
toJavaType(org.apache.kafka.common.header.Headers headers) |
fromClass, toClass
void fromJavaType(com.fasterxml.jackson.databind.JavaType javaType, org.apache.kafka.common.header.Headers headers)
com.fasterxml.jackson.databind.JavaType toJavaType(org.apache.kafka.common.header.Headers headers)
Jackson2JavaTypeMapper.TypePrecedence getTypePrecedence()
default void setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence typePrecedence)
@KafkaListener
at the method level, the framework attempts
to determine the target type for payload conversion from the method signature.
If so, this type is provided by the MessagingMessageListenerAdapter
.
By default, if the type is concrete (not abstract, not an interface), this will
be used ahead of type information provided in the __TypeId__
and
associated headers provided by the sender.
If you wish to force the use of the __TypeId__
and associated headers
(such as when the actual type is a subclass of the method argument type),
set the precedence to Jackson2JavaTypeMapper.TypePrecedence.TYPE_ID
.
typePrecedence
- the precedence.void addTrustedPackages(java.lang.String... packages)
default void removeHeaders(org.apache.kafka.common.header.Headers headers)
headers
- the headers.