Class DefaultJackson2JavaTypeMapper

    • Constructor Detail

      • DefaultJackson2JavaTypeMapper

        public DefaultJackson2JavaTypeMapper()
    • Method Detail

      • setTypePrecedence

        public void setTypePrecedence​(Jackson2JavaTypeMapper.TypePrecedence typePrecedence)
        Description copied from interface: Jackson2JavaTypeMapper
        Set the precedence for evaluating type information in message properties. When using @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.

        Specified by:
        setTypePrecedence in interface Jackson2JavaTypeMapper
        Parameters:
        typePrecedence - the precedence.
      • addTrustedPackages

        public void addTrustedPackages​(java.lang.String... packagesToTrust)
        Specify a set of packages to trust during deserialization. The asterisk (*) means trust all.
        Specified by:
        addTrustedPackages in interface Jackson2JavaTypeMapper
        Parameters:
        packagesToTrust - the trusted Java packages for deserialization
      • toJavaType

        public com.fasterxml.jackson.databind.JavaType toJavaType​(org.apache.kafka.common.header.Headers headers)
        Specified by:
        toJavaType in interface Jackson2JavaTypeMapper
      • fromJavaType

        public void fromJavaType​(com.fasterxml.jackson.databind.JavaType javaType,
                                 org.apache.kafka.common.header.Headers headers)
        Specified by:
        fromJavaType in interface Jackson2JavaTypeMapper
      • fromClass

        public void fromClass​(java.lang.Class<?> clazz,
                              org.apache.kafka.common.header.Headers headers)
        Specified by:
        fromClass in interface ClassMapper
      • toClass

        public java.lang.Class<?> toClass​(org.apache.kafka.common.header.Headers headers)
        Specified by:
        toClass in interface ClassMapper
      • removeHeaders

        public void removeHeaders​(org.apache.kafka.common.header.Headers headers)
        Description copied from interface: Jackson2JavaTypeMapper
        Remove the type information headers.
        Specified by:
        removeHeaders in interface Jackson2JavaTypeMapper
        Parameters:
        headers - the headers.