Class BasePolymorphicTypeProvider.Registry
java.lang.Object
com.norconex.commons.lang.bean.spi.BasePolymorphicTypeProvider.Registry
- Enclosing class:
BasePolymorphicTypeProvider
Helper for registering polymorphic types and sub-types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a super type and all supplied sub-types.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.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.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.
-
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 typesubType- required polymorphic sub-typesubTypes- optional additional sub-types- Returns:
- this, for chaining
-
addFromScan
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-typesbasePackage- 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-typesfilter- predicate returningtrueon matching sub-types- Returns:
- this, for chaining
-