Class StdTypeResolverBuilder
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder
-
- All Implemented Interfaces:
TypeResolverBuilder<StdTypeResolverBuilder>
- Direct Known Subclasses:
ObjectMapper.DefaultTypeResolverBuilder,XmlTypeResolverBuilder
public class StdTypeResolverBuilder extends java.lang.Object implements TypeResolverBuilder<StdTypeResolverBuilder>
DefaultTypeResolverBuilderimplementation.
-
-
Constructor Summary
Constructors Constructor Description StdTypeResolverBuilder()StdTypeResolverBuilder(JsonTypeInfo.Value settings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeDeserializerbuildTypeDeserializer(DeserializationConfig config, JavaType baseType, java.util.Collection<NamedType> subtypes)Method for building type deserializer based on current configuration of this builder.TypeSerializerbuildTypeSerializer(SerializationConfig config, JavaType baseType, java.util.Collection<NamedType> subtypes)Method for building type serializer based on current configuration of this builder.StdTypeResolverBuilderdefaultImpl(java.lang.Class<?> defaultImpl)Method for specifying default implementation to use if type id is either not available, or cannot be resolved.java.lang.Class<?>getDefaultImpl()Accessor for currently configured default type; implementation class that may be used in case no valid type information is available during type resolutionjava.lang.StringgetTypeProperty()StdTypeResolverBuilderinclusion(JsonTypeInfo.As includeAs)Method for specifying mechanism to use for including type metadata in JSON.StdTypeResolverBuilderinit(JsonTypeInfo.Id idType, TypeIdResolver idRes)Initialization method that is called right after constructing the builder instance.StdTypeResolverBuilderinit(JsonTypeInfo.Value settings, TypeIdResolver idRes)Initialization method that is called right after constructing the builder instance, in cases where information could not be passed directly (for example when instantiated for an annotation)booleanisTypeIdVisible()static StdTypeResolverBuildernoTypeInfoBuilder()PolymorphicTypeValidatorsubTypeValidator(MapperConfig<?> config)Overridable helper method for determining actual validator to use when constructing type serializers and type deserializers.StdTypeResolverBuildertypeIdVisibility(boolean isVisible)Method for specifying whether type id should be visible toJsonDeserializers or not.StdTypeResolverBuildertypeProperty(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).StdTypeResolverBuilderwithDefaultImpl(java.lang.Class<?> defaultImpl)"Mutant factory" method for creating a new instance with different default implementation.StdTypeResolverBuilderwithSettings(JsonTypeInfo.Value settings)Method for overriding type information.
-
-
-
Constructor Detail
-
StdTypeResolverBuilder
public StdTypeResolverBuilder()
-
StdTypeResolverBuilder
public StdTypeResolverBuilder(JsonTypeInfo.Value settings)
- Since:
- 2.16 (backported from Jackson 3.0)
-
-
Method Detail
-
noTypeInfoBuilder
public static StdTypeResolverBuilder noTypeInfoBuilder()
-
init
public StdTypeResolverBuilder init(JsonTypeInfo.Id idType, TypeIdResolver idRes)
Description copied from interface:TypeResolverBuilderInitialization method that is called right after constructing the builder instance.- Specified by:
initin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Parameters:
idType- Which type metadata is usedidRes- (optional) Custom type id resolver used, if any- Returns:
- Resulting builder instance (usually this builder, but not necessarily)
-
init
public StdTypeResolverBuilder init(JsonTypeInfo.Value settings, TypeIdResolver idRes)
Description copied from interface:TypeResolverBuilderInitialization method that is called right after constructing the builder instance, in cases where information could not be passed directly (for example when instantiated for an annotation)NOTE: This method is abstract in Jackson 3.0, at the moment of writing.
- Specified by:
initin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Parameters:
settings- Configuration settings to apply.- Returns:
- Resulting builder instance (usually this builder, but not necessarily)
-
buildTypeSerializer
public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, java.util.Collection<NamedType> subtypes)
Description copied from interface:TypeResolverBuilderMethod for building type serializer based on current configuration of this builder.- Specified by:
buildTypeSerializerin interfaceTypeResolverBuilder<StdTypeResolverBuilder>baseType- Base type that constructed resolver will handle; super type of all types it will be used for.
-
buildTypeDeserializer
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, java.util.Collection<NamedType> subtypes)
Description copied from interface:TypeResolverBuilderMethod for building type deserializer based on current configuration of this builder.- Specified by:
buildTypeDeserializerin interfaceTypeResolverBuilder<StdTypeResolverBuilder>baseType- Base type that constructed resolver will handle; super type of all types it will be used for.subtypes- Known subtypes of the base type.
-
inclusion
public StdTypeResolverBuilder inclusion(JsonTypeInfo.As includeAs)
Description copied from interface:TypeResolverBuilderMethod for specifying mechanism to use for including type metadata in JSON. If not explicitly called, setting defaults toJsonTypeInfo.As.PROPERTY.- Specified by:
inclusionin interfaceTypeResolverBuilder<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:
typePropertyin interfaceTypeResolverBuilder<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:TypeResolverBuilderMethod for specifying default implementation to use if type id is either not available, or cannot be resolved.- Specified by:
defaultImplin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Returns:
- Resulting builder instance (usually this builder, but may be a newly constructed instance for immutable builders}
-
typeIdVisibility
public StdTypeResolverBuilder typeIdVisibility(boolean isVisible)
Description copied from interface:TypeResolverBuilderMethod for specifying whether type id should be visible toJsonDeserializers or not.- Specified by:
typeIdVisibilityin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Returns:
- Resulting builder instance (usually this builder, but may be a newly constructed instance for immutable builders}
-
withDefaultImpl
public StdTypeResolverBuilder withDefaultImpl(java.lang.Class<?> defaultImpl)
Description copied from interface:TypeResolverBuilder"Mutant factory" method for creating a new instance with different default implementation.- Specified by:
withDefaultImplin interfaceTypeResolverBuilder<StdTypeResolverBuilder>- Returns:
- Either this instance (if nothing changed) or a new instance with different default implementation
-
withSettings
public StdTypeResolverBuilder withSettings(JsonTypeInfo.Value settings)
Description copied from interface:TypeResolverBuilderMethod for overriding type information.- Specified by:
withSettingsin interfaceTypeResolverBuilder<StdTypeResolverBuilder>
-
getDefaultImpl
public java.lang.Class<?> getDefaultImpl()
Description copied from interface:TypeResolverBuilderAccessor for currently configured default type; implementation class that may be used in case no valid type information is available during type resolution- Specified by:
getDefaultImplin interfaceTypeResolverBuilder<StdTypeResolverBuilder>
-
getTypeProperty
public java.lang.String getTypeProperty()
-
isTypeIdVisible
public boolean isTypeIdVisible()
-
subTypeValidator
public PolymorphicTypeValidator subTypeValidator(MapperConfig<?> config)
Overridable 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().- Since:
- 2.10
-
-