org.codehaus.jackson.map.jsontype.impl
Class StdTypeResolverBuilder

java.lang.Object
  extended by org.codehaus.jackson.map.jsontype.impl.StdTypeResolverBuilder
All Implemented Interfaces:
TypeResolverBuilder<StdTypeResolverBuilder>
Direct Known Subclasses:
ObjectMapper.DefaultTypeResolverBuilder

public class StdTypeResolverBuilder
extends Object
implements TypeResolverBuilder<StdTypeResolverBuilder>

Default TypeResolverBuilder implementation.

Since:
1.5
Author:
tatu

Field Summary
protected  TypeIdResolver _customIdResolver
           
protected  JsonTypeInfo.Id _idType
           
protected  JsonTypeInfo.As _includeAs
           
protected  String _typeProperty
           
 
Constructor Summary
StdTypeResolverBuilder()
           
 
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.
protected  TypeIdResolver idResolver(JavaType baseType, 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.
 StdTypeResolverBuilder inclusion(JsonTypeInfo.As includeAs)
          Method for specifying mechanism to use for including type metadata in JSON.
 StdTypeResolverBuilder init(JsonTypeInfo.Id idType, TypeIdResolver idRes)
          Initialization method that is called right after constructing the builder instance.
 StdTypeResolverBuilder typeProperty(String propName)
          Method for specifying name of property used for including type information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_idType

protected JsonTypeInfo.Id _idType

_includeAs

protected JsonTypeInfo.As _includeAs

_typeProperty

protected String _typeProperty

_customIdResolver

protected TypeIdResolver _customIdResolver
Constructor Detail

StdTypeResolverBuilder

public StdTypeResolverBuilder()
Method Detail

init

public StdTypeResolverBuilder init(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)

buildTypeSerializer

public TypeSerializer buildTypeSerializer(JavaType baseType,
                                          Collection<NamedType> subtypes)
Description copied from interface: TypeResolverBuilder
Method for building type serializer based on current configuration of this builder.

Specified by:
buildTypeSerializer in interface TypeResolverBuilder<StdTypeResolverBuilder>
Parameters:
baseType - Base type that constructed resolver will handle; super type of all types it will be used for.

buildTypeDeserializer

public TypeDeserializer buildTypeDeserializer(JavaType baseType,
                                              Collection<NamedType> subtypes)
Description copied from interface: TypeResolverBuilder
Method for building type deserializer based on current configuration of this builder.

Specified by:
buildTypeDeserializer in interface TypeResolverBuilder<StdTypeResolverBuilder>
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.

inclusion

public StdTypeResolverBuilder inclusion(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 not necessarily)

typeProperty

public StdTypeResolverBuilder typeProperty(String propName)
Description copied from interface: TypeResolverBuilder
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.

Specified by:
typeProperty in interface TypeResolverBuilder<StdTypeResolverBuilder>
Parameters:
propName - Name of JSON property to use for including type information
Returns:
Resulting builder instance (usually this builder, but not necessarily)

idResolver

protected TypeIdResolver idResolver(JavaType baseType,
                                    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.