public abstract class TypeIdResolverBase extends Object implements TypeIdResolver
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.
Modifier and Type | Field and Description |
---|---|
protected JavaType |
_baseType
Common base type for all polymorphic instances handled.
|
protected TypeFactory |
_typeFactory |
Modifier | Constructor and Description |
---|---|
protected |
TypeIdResolverBase() |
protected |
TypeIdResolverBase(JavaType baseType,
TypeFactory typeFactory) |
Modifier and Type | Method and Description |
---|---|
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMechanism, idFromValue, idFromValueAndType
protected final TypeFactory _typeFactory
protected final JavaType _baseType
protected TypeIdResolverBase()
protected TypeIdResolverBase(JavaType baseType, TypeFactory typeFactory)
public void init(JavaType bt)
TypeIdResolver
init
in interface TypeIdResolver
bt
- Base type for which this id resolver instance is
usedpublic String idFromBaseType()
TypeIdResolver
idFromBaseType
in interface TypeIdResolver
@Deprecated public JavaType typeFromId(String id)
typeFromId(DatabindContext, String)
instead
to get access to contextual informationtypeFromId
in interface TypeIdResolver
public JavaType typeFromId(DatabindContext context, String id)
typeFromId(String)
, which is given
context for accessing information, including configuration and
TypeFactory
.typeFromId
in interface TypeIdResolver
public String getDescForKnownTypeIds()
TODO: demote down to be part of TypeIdResolver
in 2.6 or 2.7
Copyright © 2008–2016 FasterXML. All rights reserved.