Class StdSubtypeResolver
java.lang.Object
com.fasterxml.jackson.databind.jsontype.SubtypeResolver
com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver
- All Implemented Interfaces:
Serializable
Standard
SubtypeResolver implementation.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionprotected void_collectAndResolve(AnnotatedClass annotatedType, NamedType namedType, MapperConfig<?> config, AnnotationIntrospector ai, HashMap<NamedType, NamedType> collectedSubtypes) Method called to find subtypes for a specific type (class), using type (class) as the unique key (in case of conflicts).protected void_collectAndResolveByTypeId(AnnotatedClass annotatedType, NamedType namedType, MapperConfig<?> config, Set<Class<?>> typesHandled, Map<String, NamedType> byName) Method called to find subtypes for a specific type (class), using type id as the unique key (in case of conflicts).protected Collection<NamedType> _combineNamedAndUnnamed(Class<?> rawBase, Set<Class<?>> typesHandled, Map<String, NamedType> byName) Helper method used for merging explicitly named types and handled classes without explicit names.collectAndResolveSubtypesByClass(MapperConfig<?> config, AnnotatedClass type) Method for finding out all reachable subtypes for given type, such that access is by type, typically needed for serialization (converting from type to type name).collectAndResolveSubtypesByClass(MapperConfig<?> config, AnnotatedMember property, JavaType baseType) Method for finding out all reachable subtypes for a property specified by given element (method or field), such that access is by type, typically needed for serialization (converting from type to type name).collectAndResolveSubtypesByTypeId(MapperConfig<?> config, AnnotatedClass baseType) Method for finding out all reachable subtypes for given type, such that access is by type id, typically needed for deserialization (converting from type id to type).collectAndResolveSubtypesByTypeId(MapperConfig<?> config, AnnotatedMember property, JavaType baseType) Method for finding out all reachable subtypes for a property specified by given element (method or field), such that access is by type id, typically needed for deserialization (converting from type id to type).copy()Method called byObjectMapper.copy()to make sure thatSubtypeResolverinstances used by two independent mappers can not cause thread-safety issues: if resolver is immutable, it may returnthis, but if not, it should create a copy with same configuration and return that instead.voidregisterSubtypes(NamedType... types) Method for registering specified subtypes (possibly including type names); for type entries without name, non-qualified class name as used as name (unless overridden by annotation).voidregisterSubtypes(Class<?>... classes) voidregisterSubtypes(Collection<Class<?>> subtypes) Methods inherited from class SubtypeResolver
collectAndResolveSubtypes, collectAndResolveSubtypes
-
Field Details
-
_registeredSubtypes
-
-
Constructor Details
-
StdSubtypeResolver
public StdSubtypeResolver() -
StdSubtypeResolver
-
-
Method Details
-
copy
Description copied from class:SubtypeResolverMethod called byObjectMapper.copy()to make sure thatSubtypeResolverinstances used by two independent mappers can not cause thread-safety issues: if resolver is immutable, it may returnthis, but if not, it should create a copy with same configuration and return that instead.- Overrides:
copyin classSubtypeResolver- Returns:
- Either new instance with same configuration as this one (if instances are mutable), or this instance (if immutable)
-
registerSubtypes
Description copied from class:SubtypeResolverMethod for registering specified subtypes (possibly including type names); for type entries without name, non-qualified class name as used as name (unless overridden by annotation).- Specified by:
registerSubtypesin classSubtypeResolver
-
registerSubtypes
- Specified by:
registerSubtypesin classSubtypeResolver
-
registerSubtypes
- Specified by:
registerSubtypesin classSubtypeResolver
-
collectAndResolveSubtypesByClass
public Collection<NamedType> collectAndResolveSubtypesByClass(MapperConfig<?> config, AnnotatedMember property, JavaType baseType) Description copied from class:SubtypeResolverMethod for finding out all reachable subtypes for a property specified by given element (method or field), such that access is by type, typically needed for serialization (converting from type to type name).- Overrides:
collectAndResolveSubtypesByClassin classSubtypeResolver- Parameters:
baseType- Effective property base type to use; may differ from actual type of property; for structured types it is content (value) type and NOT structured type.
-
collectAndResolveSubtypesByClass
public Collection<NamedType> collectAndResolveSubtypesByClass(MapperConfig<?> config, AnnotatedClass type) Description copied from class:SubtypeResolverMethod for finding out all reachable subtypes for given type, such that access is by type, typically needed for serialization (converting from type to type name).- Overrides:
collectAndResolveSubtypesByClassin classSubtypeResolver- Parameters:
type- Effective property base type to use; may differ from actual type of property; for structured types it is content (value) type and NOT structured type.
-
collectAndResolveSubtypesByTypeId
public Collection<NamedType> collectAndResolveSubtypesByTypeId(MapperConfig<?> config, AnnotatedMember property, JavaType baseType) Description copied from class:SubtypeResolverMethod for finding out all reachable subtypes for a property specified by given element (method or field), such that access is by type id, typically needed for deserialization (converting from type id to type).- Overrides:
collectAndResolveSubtypesByTypeIdin classSubtypeResolver- Parameters:
baseType- Effective property base type to use; may differ from actual type of property; for structured types it is content (value) type and NOT structured type.
-
collectAndResolveSubtypesByTypeId
public Collection<NamedType> collectAndResolveSubtypesByTypeId(MapperConfig<?> config, AnnotatedClass baseType) Description copied from class:SubtypeResolverMethod for finding out all reachable subtypes for given type, such that access is by type id, typically needed for deserialization (converting from type id to type).- Overrides:
collectAndResolveSubtypesByTypeIdin classSubtypeResolver- Parameters:
baseType- Effective property base type to use; may differ from actual type of property; for structured types it is content (value) type and NOT structured type.
-
_collectAndResolve
protected void _collectAndResolve(AnnotatedClass annotatedType, NamedType namedType, MapperConfig<?> config, AnnotationIntrospector ai, HashMap<NamedType, NamedType> collectedSubtypes) Method called to find subtypes for a specific type (class), using type (class) as the unique key (in case of conflicts). -
_collectAndResolveByTypeId
protected void _collectAndResolveByTypeId(AnnotatedClass annotatedType, NamedType namedType, MapperConfig<?> config, Set<Class<?>> typesHandled, Map<String, NamedType> byName) Method called to find subtypes for a specific type (class), using type id as the unique key (in case of conflicts). -
_combineNamedAndUnnamed
-