public class MinimalClassNameIdResolver extends ClassNameIdResolver
ClassNameIdResolver
that instead uses a
"minimal" derivation of Class
name, using relative reference
from the base type (base class) that polymorphic value has.Modifier and Type | Field and Description |
---|---|
protected String |
_basePackageName
Package name of the base class, to be used for determining common
prefix that can be omitted from included type id.
|
protected String |
_basePackagePrefix
Same as
_basePackageName , but includes trailing dot. |
_subTypeValidator
_baseType, _typeFactory
Modifier | Constructor and Description |
---|---|
protected |
MinimalClassNameIdResolver(JavaType baseType,
TypeFactory typeFactory,
PolymorphicTypeValidator ptv) |
Modifier and Type | Method and Description |
---|---|
protected JavaType |
_typeFromId(String id,
DatabindContext ctxt) |
static MinimalClassNameIdResolver |
construct(JavaType baseType,
MapperConfig<?> config,
PolymorphicTypeValidator ptv) |
com.fasterxml.jackson.annotation.JsonTypeInfo.Id |
getMechanism()
Accessor for mechanism that this resolver uses for determining
type id from type.
|
String |
idFromValue(Object value)
Method called to serialize type of the type of given value
as a String to include in serialized JSON content.
|
String |
idFromValueAndType(Object value,
Class<?> rawType)
Alternative method used for determining type from combination of
value and type, using suggested type (that serializer provides)
and possibly value of that type.
|
_idFrom, getDescForKnownTypeIds, registerSubtype, typeFromId
_resolveToParentAsNecessary, idFromBaseType, init
protected final String _basePackageName
protected final String _basePackagePrefix
_basePackageName
, but includes trailing dot.protected MinimalClassNameIdResolver(JavaType baseType, TypeFactory typeFactory, PolymorphicTypeValidator ptv)
public static MinimalClassNameIdResolver construct(JavaType baseType, MapperConfig<?> config, PolymorphicTypeValidator ptv)
public com.fasterxml.jackson.annotation.JsonTypeInfo.Id getMechanism()
TypeIdResolver
getMechanism
in interface TypeIdResolver
getMechanism
in class ClassNameIdResolver
public String idFromValue(Object value)
TypeIdResolver
idFromValue
in interface TypeIdResolver
idFromValue
in class ClassNameIdResolver
public String idFromValueAndType(Object value, Class<?> rawType)
TypeIdResolver
idFromValueAndType
in interface TypeIdResolver
idFromValueAndType
in class ClassNameIdResolver
protected JavaType _typeFromId(String id, DatabindContext ctxt) throws IOException
_typeFromId
in class ClassNameIdResolver
IOException
Copyright © 2008–2024 FasterXML. All rights reserved.