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 ALL sub-class need to re-implement
typeFromId(DatabindContext, String)
method; otherwise implementation
will not work.
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)
Method called to resolve type from given type identifier.
|
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
public JavaType typeFromId(DatabindContext context, String id) throws IOException
TypeIdResolver
typeFromId
in interface TypeIdResolver
IOException
public String getDescForKnownTypeIds()
getDescForKnownTypeIds
in interface TypeIdResolver
Copyright © 2008–2016 FasterXML. All rights reserved.