org.codehaus.jackson.map.jsontype
Interface TypeResolverBuilder<T extends TypeResolverBuilder<T>>

All Known Implementing Classes:
ObjectMapper.DefaultTypeResolverBuilder, StdTypeResolverBuilder

public interface TypeResolverBuilder<T extends TypeResolverBuilder<T>>

Interface that defines builders that are configured based on annotations (like JsonTypeInfo or JAXB annotations), and produce type serializers and deserializers used for handling type information embedded in JSON to allow for safe polymorphic type handling.

Builder is first initialized by calling init(org.codehaus.jackson.annotate.JsonTypeInfo.Id, org.codehaus.jackson.map.jsontype.TypeIdResolver) method, and then configured using setXxx (and registerXxx) methods. Finally, after calling all configuration methods, buildTypeSerializer(org.codehaus.jackson.type.JavaType, java.util.Collection) or buildTypeDeserializer(org.codehaus.jackson.type.JavaType, java.util.Collection) will be called to get actual type resolver constructed and used for resolving types for configured base type and its subtypes.

Since:
1.5
Author:
tatu

Method Summary
 TypeDeserializer buildTypeDeserializer(JavaType baseType, Collection<NamedType> subtypes)
          Method for building type deserializer based on current configuration of this builder.
 TypeSerializer buildTypeSerializer(JavaType baseType, Collection<NamedType> subtypes)
          Method for building type serializer based on current configuration of this builder.
 T inclusion(JsonTypeInfo.As includeAs)
          Method for specifying mechanism to use for including type metadata in JSON.
 T init(JsonTypeInfo.Id idType, TypeIdResolver res)
          Initialization method that is called right after constructing the builder instance.
 T typeProperty(String propName)
          Method for specifying name of property used for including type information.
 

Method Detail

buildTypeSerializer

TypeSerializer buildTypeSerializer(JavaType baseType,
                                   Collection<NamedType> subtypes)
Method for building type serializer based on current configuration of this builder.

Parameters:
baseType - Base type that constructed resolver will handle; super type of all types it will be used for.

buildTypeDeserializer

TypeDeserializer buildTypeDeserializer(JavaType baseType,
                                       Collection<NamedType> subtypes)
Method for building type deserializer based on current configuration of this builder.

Parameters:
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.

init

T init(JsonTypeInfo.Id idType,
       TypeIdResolver res)
Initialization method that is called right after constructing the builder instance.

Parameters:
idType - Which type metadata is used
res - (optional) Custom type id resolver used, if any
Returns:
Resulting builder instance (usually this builder, but not necessarily)

inclusion

T inclusion(JsonTypeInfo.As includeAs)
Method for specifying mechanism to use for including type metadata in JSON. If not explicitly called, setting defaults to JsonTypeInfo.As#PROPERTY.

Parameters:
includeAs - Mechanism used for including type metadata in JSON
Returns:
Resulting builder instance (usually this builder, but not necessarily)

typeProperty

T typeProperty(String propName)
Method for specifying name of property used for including type information. Not used for all inclusiong mechanisms; usually only used with JsonTypeInfo.As#PROPERTY.

If not explicitly called, name of property to use is based on defaults for configured.

Parameters:
propName - Name of JSON property to use for including type information
Returns:
Resulting builder instance (usually this builder, but not necessarily)