com.fasterxml.jackson.databind.jsontype.impl

## Class TypeIdResolverBase

- java.lang.Object
- - com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase

All Implemented Interfaces:
  TypeIdResolver

Direct Known Subclasses:
  ClassNameIdResolver, TypeNameIdResolver

    public abstract class TypeIdResolverBase
    extends Object
    implements TypeIdResolver

Partial base implementation of `TypeIdResolver`: all custom implementations are strongly recommended to extend this class, instead of directly implementing `TypeIdResolver`.

Note that instances created to be constructed from annotations (`JsonTypeIdResolver`) are always created using no-arguments constructor; protected constructor is only used sub-classes.

### Field Summary

Fields
`protected JavaType` `_baseType` Common base type for all polymorphic instances handled.
`protected TypeFactory` `_typeFactory`

### Constructor Summary

Constructors
`protected` `TypeIdResolverBase()`
`protected` `TypeIdResolverBase(JavaType baseType, TypeFactory typeFactory)`

### Method Summary

Methods
`String` `getDescForKnownTypeIds()` Helper method used to get a simple description of all known type ids, for use in error messages.
`String` `idFromBaseType()` Method that can be called to figure out type id to use for instances of base type (declared type of property).
`void` `init(JavaType bt)` Method that will be called once before any type resolution calls; used to initialize instance with configuration.
`JavaType` `typeFromId(DatabindContext context, String id)` New method, replacement for `typeFromId(String)`, which is given context for accessing information, including configuration and `TypeFactory`.
`JavaType` `typeFromId(String id)` Deprecated. Since 2.3, override `typeFromId(DatabindContext, String)` instead to get access to contextual information

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver

`getMechanism, idFromValue, idFromValueAndType`

### Field Detail

#### _typeFactory

    protected final TypeFactory _typeFactory

#### _baseType

    protected final JavaType _baseType

Common base type for all polymorphic instances handled.

### Constructor Detail

#### TypeIdResolverBase

    protected TypeIdResolverBase()

#### TypeIdResolverBase

    protected TypeIdResolverBase(JavaType baseType,
                      TypeFactory typeFactory)

### Method Detail

#### init

    public void init(JavaType bt)

Description copied from interface: `TypeIdResolver`
Method that will be called once before any type resolution calls; used to initialize instance with configuration. This is necessary since instances may be created via reflection, without ability to call specific constructor to pass in configuration settings.

Specified by:
  `init` in interface `TypeIdResolver`
Parameters:
  `bt` - Base type for which this id resolver instance is used

#### idFromBaseType

    public String idFromBaseType()

Description copied from interface: `TypeIdResolver`
Method that can be called to figure out type id to use for instances of base type (declared type of property). This is usually only used for fallback handling, for cases where real type information is not available for some reason.

Specified by:
  `idFromBaseType` in interface `TypeIdResolver`

#### typeFromId

    @Deprecated
    public JavaType typeFromId(String id)

Deprecated. Since 2.3, override `typeFromId(DatabindContext, String)` instead to get access to contextual information

Specified by:
  `typeFromId` in interface `TypeIdResolver`

#### typeFromId

    public JavaType typeFromId(DatabindContext context,
                      String id)

New method, replacement for `typeFromId(String)`, which is given context for accessing information, including configuration and `TypeFactory`.

Specified by:
  `typeFromId` in interface `TypeIdResolver`
Returns:
  Type for given id
Since:
  2.3

#### getDescForKnownTypeIds

    public String getDescForKnownTypeIds()

Helper method used to get a simple description of all known type ids, for use in error messages.

TODO: demote down to be part of `TypeIdResolver` in 2.6 or 2.7