Class MinimalClassNameIdResolver
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
-
- com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver
-
- com.fasterxml.jackson.databind.jsontype.impl.MinimalClassNameIdResolver
-
- All Implemented Interfaces:
TypeIdResolver,java.io.Serializable
public class MinimalClassNameIdResolver extends ClassNameIdResolver
Specialization ofClassNameIdResolverthat instead uses a "minimal" derivation ofClassname, using relative reference from the base type (base class) that polymorphic value has.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String_basePackageNamePackage name of the base class, to be used for determining common prefix that can be omitted from included type id.protected java.lang.String_basePackagePrefixSame as_basePackageName, but includes trailing dot.-
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver
_subTypeValidator
-
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
_baseType, _typeFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMinimalClassNameIdResolver(JavaType baseType, TypeFactory typeFactory, PolymorphicTypeValidator ptv)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JavaType_typeFromId(java.lang.String id, DatabindContext ctxt)static MinimalClassNameIdResolverconstruct(JavaType baseType, MapperConfig<?> config, PolymorphicTypeValidator ptv)com.fasterxml.jackson.annotation.JsonTypeInfo.IdgetMechanism()Accessor for mechanism that this resolver uses for determining type id from type.java.lang.StringidFromValue(java.lang.Object value)Method called to serialize type of the type of given value as a String to include in serialized JSON content.-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver
_idFrom, getDescForKnownTypeIds, idFromValueAndType, registerSubtype, typeFromId
-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
idFromBaseType, init
-
-
-
-
Field Detail
-
_basePackageName
protected final java.lang.String _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
protected final java.lang.String _basePackagePrefix
Same as_basePackageName, but includes trailing dot.
-
-
Constructor Detail
-
MinimalClassNameIdResolver
protected MinimalClassNameIdResolver(JavaType baseType, TypeFactory typeFactory, PolymorphicTypeValidator ptv)
-
-
Method Detail
-
construct
public static MinimalClassNameIdResolver construct(JavaType baseType, MapperConfig<?> config, PolymorphicTypeValidator ptv)
-
getMechanism
public com.fasterxml.jackson.annotation.JsonTypeInfo.Id 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
public java.lang.String idFromValue(java.lang.Object value)
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
-
_typeFromId
protected JavaType _typeFromId(java.lang.String id, DatabindContext ctxt) throws java.io.IOException
- Overrides:
_typeFromIdin classClassNameIdResolver- Throws:
java.io.IOException
-
-