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 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