Module tools.jackson.databind
Class MinimalClassNameIdResolver
java.lang.Object
tools.jackson.databind.jsontype.impl.TypeIdResolverBase
tools.jackson.databind.jsontype.impl.ClassNameIdResolver
tools.jackson.databind.jsontype.impl.MinimalClassNameIdResolver
- All Implemented Interfaces:
Serializable,TypeIdResolver
Specialization of
ClassNameIdResolver that instead uses a
"minimal" derivation of Class name, using relative reference
from the base type (base class) that polymorphic value has.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringPackage name of the base class, to be used for determining common prefix that can be omitted from included type id.protected final StringSame as_basePackageName, but includes trailing dot.Fields inherited from class tools.jackson.databind.jsontype.impl.ClassNameIdResolver
_allowedSubtypes, _subTypeValidatorFields inherited from class tools.jackson.databind.jsontype.impl.TypeIdResolverBase
_baseType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMinimalClassNameIdResolver(JavaType baseType, Collection<NamedType> subtypes, PolymorphicTypeValidator ptv) -
Method Summary
Modifier and TypeMethodDescriptionprotected JavaType_typeFromId(DatabindContext ctxt, String id) static MinimalClassNameIdResolverconstruct(JavaType baseType, Collection<NamedType> subtypes, PolymorphicTypeValidator ptv) Accessor for mechanism that this resolver uses for determining type id from type.idFromValue(DatabindContext ctxt, Object value) Method called to serialize type of the type of given value as a String to include in serialized JSON content.idFromValueAndType(DatabindContext ctxt, 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.Methods inherited from class tools.jackson.databind.jsontype.impl.ClassNameIdResolver
_idFrom, getDescForKnownTypeIds, typeFromIdMethods inherited from class tools.jackson.databind.jsontype.impl.TypeIdResolverBase
_resolveToParentAsNecessary, idFromBaseType, init
-
Field Details
-
_basePackageName
Package name of the base class, to be used for determining common prefix that can be omitted from included type id. Does not include the trailing dot. -
_basePackagePrefix
Same as_basePackageName, but includes trailing dot.
-
-
Constructor Details
-
MinimalClassNameIdResolver
protected MinimalClassNameIdResolver(JavaType baseType, Collection<NamedType> subtypes, PolymorphicTypeValidator ptv)
-
-
Method Details
-
construct
public static MinimalClassNameIdResolver construct(JavaType baseType, Collection<NamedType> subtypes, PolymorphicTypeValidator ptv) -
getMechanism
Description copied from interface:TypeIdResolverAccessor for mechanism that this resolver uses for determining type id from type. Mostly informational; not required to be called or used.- Specified by:
getMechanismin interfaceTypeIdResolver- Overrides:
getMechanismin classClassNameIdResolver
-
idFromValue
Description copied from interface:TypeIdResolverMethod called to serialize type of the type of given value as a String to include in serialized JSON content.- Specified by:
idFromValuein interfaceTypeIdResolver- Overrides:
idFromValuein classClassNameIdResolver
-
idFromValueAndType
Description copied from interface:TypeIdResolverAlternative method used for determining type from combination of value and type, using suggested type (that serializer provides) and possibly value of that type. Most common implementation will use suggested type as is.- Specified by:
idFromValueAndTypein interfaceTypeIdResolver- Overrides:
idFromValueAndTypein classClassNameIdResolver
-
_typeFromId
- Overrides:
_typeFromIdin classClassNameIdResolver- Throws:
JacksonException
-