Class StdTypeResolverBuilder

    • Field Detail

      • _idType

        protected com.fasterxml.jackson.annotation.JsonTypeInfo.Id _idType
      • _includeAs

        protected com.fasterxml.jackson.annotation.JsonTypeInfo.As _includeAs
      • _typeProperty

        protected java.lang.String _typeProperty
      • _typeIdVisible

        protected boolean _typeIdVisible
        Whether type id should be exposed to deserializers or not
      • _defaultImpl

        protected java.lang.Class<?> _defaultImpl
        Default class to use in case type information is not available or is broken.
    • Constructor Detail

      • StdTypeResolverBuilder

        public StdTypeResolverBuilder()
      • StdTypeResolverBuilder

        protected StdTypeResolverBuilder​(com.fasterxml.jackson.annotation.JsonTypeInfo.Id idType,
                                         com.fasterxml.jackson.annotation.JsonTypeInfo.As idAs,
                                         java.lang.String propName)
        Since:
        2.9
    • Method Detail

      • init

        public StdTypeResolverBuilder init​(com.fasterxml.jackson.annotation.JsonTypeInfo.Id idType,
                                           TypeIdResolver idRes)
        Description copied from interface: TypeResolverBuilder
        Initialization method that is called right after constructing the builder instance.
        Specified by:
        init in interface TypeResolverBuilder<StdTypeResolverBuilder>
        Parameters:
        idType - Which type metadata is used
        idRes - (optional) Custom type id resolver used, if any
        Returns:
        Resulting builder instance (usually this builder, but not necessarily)
      • inclusion

        public StdTypeResolverBuilder inclusion​(com.fasterxml.jackson.annotation.JsonTypeInfo.As includeAs)
        Description copied from interface: TypeResolverBuilder
        Method for specifying mechanism to use for including type metadata in JSON. If not explicitly called, setting defaults to JsonTypeInfo.As.PROPERTY.
        Specified by:
        inclusion in interface TypeResolverBuilder<StdTypeResolverBuilder>
        Parameters:
        includeAs - Mechanism used for including type metadata in JSON
        Returns:
        Resulting builder instance (usually this builder, but may be a newly constructed instance for immutable builders}
      • typeProperty

        public StdTypeResolverBuilder typeProperty​(java.lang.String typeIdPropName)
        Method for constructing an instance with specified type property name (property name to use for type id when using "as-property" inclusion).
        Specified by:
        typeProperty in interface TypeResolverBuilder<StdTypeResolverBuilder>
        Parameters:
        typeIdPropName - Name of JSON property to use for including type information
        Returns:
        Resulting builder instance (usually this builder, but may be a newly constructed instance for immutable builders}
      • defaultImpl

        public StdTypeResolverBuilder defaultImpl​(java.lang.Class<?> defaultImpl)
        Description copied from interface: TypeResolverBuilder
        Method for specifying default implementation to use if type id is either not available, or cannot be resolved.
        Specified by:
        defaultImpl in interface TypeResolverBuilder<StdTypeResolverBuilder>
        Returns:
        Resulting builder instance (usually this builder, but may be a newly constructed instance for immutable builders}
      • getTypeProperty

        public java.lang.String getTypeProperty()
      • isTypeIdVisible

        public boolean isTypeIdVisible()
      • idResolver

        protected TypeIdResolver idResolver​(MapperConfig<?> config,
                                            JavaType baseType,
                                            PolymorphicTypeValidator subtypeValidator,
                                            java.util.Collection<NamedType> subtypes,
                                            boolean forSer,
                                            boolean forDeser)
        Helper method that will either return configured custom type id resolver, or construct a standard resolver given configuration.
      • verifyBaseTypeValidity

        protected PolymorphicTypeValidator verifyBaseTypeValidity​(MapperConfig<?> config,
                                                                  JavaType baseType)
        Helper method called to check that base type is valid regarding possible constraints on basetype/subtype combinations allowed for polymorphic type handling. Currently limits are verified for class name - based methods only.
        Since:
        2.10
      • allowPrimitiveTypes

        protected boolean allowPrimitiveTypes​(MapperConfig<?> config,
                                              JavaType baseType)
        Overridable helper method that is called to determine whether type serializers and type deserializers may be created even if base type is Java primitive type. Default implementation simply returns false (since primitive types can not be sub-classed, are never polymorphic) but custom implementations may change the logic for some special cases.
        Parameters:
        config - Currently active configuration
        baseType - Primitive base type for property being handled
        Returns:
        True if type (de)serializer may be created even if base type is Java primitive type; false if not
        Since:
        2.11.1