public class TypeNameIdResolver extends TypeIdResolverBase
Modifier and Type | Field and Description |
---|---|
protected MapperConfig<?> |
_config |
protected java.util.HashMap<java.lang.String,JavaType> |
_idToType
Mappings from type id to JavaType, used for deserialization
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
_typeToId
Mappings from class name to type id, used for serialization
|
_baseType, _typeFactory
Modifier | Constructor and Description |
---|---|
protected |
TypeNameIdResolver(MapperConfig<?> config,
JavaType baseType,
java.util.HashMap<java.lang.String,java.lang.String> typeToId,
java.util.HashMap<java.lang.String,JavaType> idToType) |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
_defaultTypeId(java.lang.Class<?> cls)
If no name was explicitly given for a class, we will just
use non-qualified class name
|
static TypeNameIdResolver |
construct(MapperConfig<?> config,
JavaType baseType,
java.util.Collection<NamedType> subtypes,
boolean forSer,
boolean forDeser) |
JsonTypeInfo.Id |
getMechanism()
Accessor for mechanism that this resolver uses for determining
type id from type.
|
java.lang.String |
idFromValue(java.lang.Object value)
Method called to serialize type of the type of given value
as a String to include in serialized JSON content.
|
java.lang.String |
idFromValueAndType(java.lang.Object value,
java.lang.Class<?> type)
Alternative method used for determining type from combination of
value and type, using suggested type (that serializer provides)
and possibly value of that type.
|
java.lang.String |
toString() |
JavaType |
typeFromId(java.lang.String id)
Method called to resolve type from given type identifier.
|
idFromBaseType, init
protected final MapperConfig<?> _config
protected final java.util.HashMap<java.lang.String,java.lang.String> _typeToId
protected final java.util.HashMap<java.lang.String,JavaType> _idToType
protected TypeNameIdResolver(MapperConfig<?> config, JavaType baseType, java.util.HashMap<java.lang.String,java.lang.String> typeToId, java.util.HashMap<java.lang.String,JavaType> idToType)
public static TypeNameIdResolver construct(MapperConfig<?> config, JavaType baseType, java.util.Collection<NamedType> subtypes, boolean forSer, boolean forDeser)
public JsonTypeInfo.Id getMechanism()
TypeIdResolver
public java.lang.String idFromValue(java.lang.Object value)
TypeIdResolver
public java.lang.String idFromValueAndType(java.lang.Object value, java.lang.Class<?> type)
TypeIdResolver
public JavaType typeFromId(java.lang.String id) throws java.lang.IllegalArgumentException
TypeIdResolver
java.lang.IllegalArgumentException
public java.lang.String toString()
toString
in class java.lang.Object
protected static java.lang.String _defaultTypeId(java.lang.Class<?> cls)