Package com.fasterxml.jackson.databind
Class ObjectMapper.DefaultTypeResolverBuilder
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder
-
- com.fasterxml.jackson.databind.ObjectMapper.DefaultTypeResolverBuilder
-
- All Implemented Interfaces:
TypeResolverBuilder<StdTypeResolverBuilder>,Serializable
- Enclosing class:
- ObjectMapper
public static class ObjectMapper.DefaultTypeResolverBuilder extends StdTypeResolverBuilder implements Serializable
CustomizedTypeResolverBuilderthat provides type resolver builders used with so-called "default typing" (seeObjectMapper.activateDefaultTyping(PolymorphicTypeValidator)for details).Type resolver construction is based on configuration: implementation takes care of only providing builders in cases where type information should be applied. This is important since build calls may be sent for any and all types, and type information should NOT be applied to all of them.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectMapper.DefaultTyping_appliesForDefinition of what types is this default typer valid for.protected PolymorphicTypeValidator_subtypeValidatorPolymorphicTypeValidatortop use for validating that the subtypes resolved are valid for use (usually to protect against possible security issues)-
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder
_customIdResolver, _defaultImpl, _idType, _includeAs, _typeIdVisible, _typeProperty
-
-
Constructor Summary
Constructors Constructor Description DefaultTypeResolverBuilder(ObjectMapper.DefaultTyping t)Deprecated.Since 2.10DefaultTypeResolverBuilder(ObjectMapper.DefaultTyping t, PolymorphicTypeValidator ptv)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeDeserializerbuildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes)Method for building type deserializer based on current configuration of this builder.TypeSerializerbuildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes)Method for building type serializer based on current configuration of this builder.static ObjectMapper.DefaultTypeResolverBuilderconstruct(ObjectMapper.DefaultTyping t, PolymorphicTypeValidator ptv)PolymorphicTypeValidatorsubTypeValidator(MapperConfig<?> config)Overridable helper method for determining actual validator to use when constructing type serializers and type deserializers.booleanuseForType(JavaType t)Method called to check if the default type handler should be used for given type.-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder
defaultImpl, defineDefaultImpl, getDefaultImpl, getTypeProperty, idResolver, inclusion, init, isTypeIdVisible, noTypeInfoBuilder, reportInvalidBaseType, typeIdVisibility, typeProperty, verifyBaseTypeValidity
-
-
-
-
Field Detail
-
_appliesFor
protected final ObjectMapper.DefaultTyping _appliesFor
Definition of what types is this default typer valid for.
-
_subtypeValidator
protected final PolymorphicTypeValidator _subtypeValidator
PolymorphicTypeValidatortop use for validating that the subtypes resolved are valid for use (usually to protect against possible security issues)- Since:
- 2.10
-
-
Constructor Detail
-
DefaultTypeResolverBuilder
@Deprecated public DefaultTypeResolverBuilder(ObjectMapper.DefaultTyping t)
Deprecated.Since 2.10
-
DefaultTypeResolverBuilder
public DefaultTypeResolverBuilder(ObjectMapper.DefaultTyping t, PolymorphicTypeValidator ptv)
- Since:
- 2.10
-
-
Method Detail
-
construct
public static ObjectMapper.DefaultTypeResolverBuilder construct(ObjectMapper.DefaultTyping t, PolymorphicTypeValidator ptv)
- Since:
- 2.10
-
subTypeValidator
public PolymorphicTypeValidator subTypeValidator(MapperConfig<?> config)
Description copied from class:StdTypeResolverBuilderOverridable helper method for determining actual validator to use when constructing type serializers and type deserializers.Default implementation simply uses one configured and accessible using
MapperConfig.getPolymorphicTypeValidator().- Overrides:
subTypeValidatorin classStdTypeResolverBuilder
-
buildTypeDeserializer
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes)
Description copied from interface:TypeResolverBuilderMethod for building type deserializer based on current configuration of this builder.- Specified by:
buildTypeDeserializerin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Overrides:
buildTypeDeserializerin classStdTypeResolverBuilderbaseType- Base type that constructed resolver will handle; super type of all types it will be used for.subtypes- Known subtypes of the base type.
-
buildTypeSerializer
public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes)
Description copied from interface:TypeResolverBuilderMethod for building type serializer based on current configuration of this builder.- Specified by:
buildTypeSerializerin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Overrides:
buildTypeSerializerin classStdTypeResolverBuilderbaseType- Base type that constructed resolver will handle; super type of all types it will be used for.
-
useForType
public boolean useForType(JavaType t)
Method called to check if the default type handler should be used for given type. Note: "natural types" (String, Boolean, Integer, Double) will never use typing; that is both due to them being concrete and final, and since actual serializers and deserializers will also ignore any attempts to enforce typing.
-
-