Package com.norconex.commons.lang.bean.spi

# Class BasePolymorphicTypeProvider.Registry

java.lang.Object
com.norconex.commons.lang.bean.spi.BasePolymorphicTypeProvider.Registry

Enclosing class:
  `BasePolymorphicTypeProvider`

public static class BasePolymorphicTypeProvider.Registry extends Object
Helper for registering polymorphic types and sub-types.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Registry()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BasePolymorphicTypeProvider.Registry`
  `add(@NonNull Class<?> superType, @NonNull Class<?> subType, Class<?>... subTypes)`
  Adds a super type and all supplied sub-types.
  `BasePolymorphicTypeProvider.Registry`
  `addFromScan(@NonNull Class<?> superType)`
  Adds a super type and all sub-types discovered from scanning for classes with a qualified name starting with the same package as the super class.
  `BasePolymorphicTypeProvider.Registry`
  `addFromScan(@NonNull Class<?> superType, @NonNull String basePackage)`
  Adds a super type and all sub-types discovered from scanning for classes with a qualified name starting with the supplied base package.
  `BasePolymorphicTypeProvider.Registry`
  `addFromScan(@NonNull Class<?> superType, @NonNull Predicate<String> filter)`
  Adds a super type and all sub-types discovered from scanning for classes with a qualified name matching the supplied predicate.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Registry

    public Registry()

- ## Method Details

  - ### add

    public BasePolymorphicTypeProvider.Registry add(@NonNull @NonNull Class<?> superType, @NonNull @NonNull Class<?> subType, Class<?>... subTypes)
    Adds a super type and all supplied sub-types.
    Parameters:
      `superType` - polymorphic type
      `subType` - required polymorphic sub-type
      `subTypes` - optional additional sub-types
    Returns:
      this, for chaining

  - ### addFromScan

    public BasePolymorphicTypeProvider.Registry addFromScan(@NonNull @NonNull Class<?> superType)
    Adds a super type and all sub-types discovered from scanning for classes with a qualified name starting with the same package as the super class. Scanning is performed using the super type class loader.
    Parameters:
      `superType` - polymorphic type to add and discover its sub-types
    Returns:
      this, for chaining

  - ### addFromScan

    public BasePolymorphicTypeProvider.Registry addFromScan(@NonNull @NonNull Class<?> superType, @NonNull @NonNull String basePackage)
    Adds a super type and all sub-types discovered from scanning for classes with a qualified name starting with the supplied base package. Scanning is performed using the super type class loader.
    Parameters:
      `superType` - polymorphic type to add and discover its sub-types
      `basePackage` - the fully qualified class names prefix to match
    Returns:
      this, for chaining

  - ### addFromScan

    public BasePolymorphicTypeProvider.Registry addFromScan(@NonNull @NonNull Class<?> superType, @NonNull @NonNull Predicate<String> filter)
    Adds a super type and all sub-types discovered from scanning for classes with a qualified name matching the supplied predicate. Scanning is performed using the super type class loader.
    Parameters:
      `superType` - polymorphic type to add and discover its sub-types
      `filter` - predicate returning `true` on matching sub-types
    Returns:
      this, for chaining