Class SubtypeResolver

  • Direct Known Subclasses:
    StdSubtypeResolver

    public abstract class SubtypeResolver
    extends java.lang.Object
    Helper object used for handling registration on resolving of super-types to sub-types.
    • Constructor Detail

      • SubtypeResolver

        public SubtypeResolver()
    • Method Detail

      • copy

        public SubtypeResolver copy()
        Method called by ObjectMapper.copy() to make sure that SubtypeResolver instances used by two independent mappers can not cause thread-safety issues: if resolver is immutable, it may return this, but if not, it should create a copy with same configuration and return that instead.
        Returns:
        Either new instance with same configuration as this one (if instances are mutable), or this instance (if immutable)
        Since:
        2.12
      • registerSubtypes

        public abstract void registerSubtypes​(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).
      • registerSubtypes

        public abstract void registerSubtypes​(java.lang.Class<?>... classes)
      • registerSubtypes

        public abstract void registerSubtypes​(java.util.Collection<java.lang.Class<?>> subtypes)
        Since:
        2.9
      • collectAndResolveSubtypesByClass

        public java.util.Collection<NamedType> 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).
        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.
        Since:
        2.6
      • collectAndResolveSubtypesByClass

        public java.util.Collection<NamedType> collectAndResolveSubtypesByClass​(MapperConfig<?> config,
                                                                                AnnotatedClass baseType)
        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).
        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.
        Since:
        2.6
      • collectAndResolveSubtypesByTypeId

        public java.util.Collection<NamedType> 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).
        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.
        Since:
        2.6
      • collectAndResolveSubtypesByTypeId

        public java.util.Collection<NamedType> 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).
        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.
        Since:
        2.6