Package dev.orne.test.rnd.params
Class ParametersExtractors
java.lang.Object
dev.orne.test.rnd.params.ParametersExtractors
Registry of generation parameters source extractors.
Registers extractors declared in
/META-INF/services/dev.orne.test.rnd.params.ParametersSourceExtractor
SPI files in the class path.
- Since:
- 0.1
- Version:
- 1.0, 2022-11
- Author:
- (w) Iker Hernaez
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for parameters extractor builder.static interfaceFunctional interface for generation parameters source extractors filter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<ParametersSourceExtractor>The parameter source extractors comparator by priority.static final ParametersExtractors.ExtractorBuilderThe default parameters extractor builder.static final ParametersExtractors.SourceExtractorFilterThe default parameters source extractors filter. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ParametersExtractors.ExtractorBuilderReturns the parameters extractor builder.static <P> ParametersExtractor<P>getExtractor(@NotNull Class<P> parametersType) Returns a generation parameters extractor for the specified parameters type.static @NotNull ParametersExtractors.SourceExtractorFilterReturns the generation parameters source extractors filter.static @NotNull List<ParametersSourceExtractor<?,?>> Returns an unmodifiable list with the registered parameter source extractors.static voidregister(@NotNull ParametersSourceExtractor<?, ?>... extractors) Adds the specified parameter source extractors to the registered extractors.static voidregister(@NotNull Collection<ParametersSourceExtractor<?, ?>> extractors) Adds the specified parameter source extractors to the registered extractors.static voidremove(@NotNull ParametersSourceExtractor<?, ?>... extractors) Removes the specified parameter source extractors from the registered extractors.static voidremove(@NotNull Collection<ParametersSourceExtractor<?, ?>> extractors) Removes the specified parameter source extractors from the registered extractors.static voidreset()Resets the loaded and cached extractors.static voidsetBuilder(@NotNull ParametersExtractors.ExtractorBuilder builder) Sets the parameters extractor builder.static voidsetFilter(@NotNull ParametersExtractors.SourceExtractorFilter filter) Sets the generation parameters source extractors filter.
-
Field Details
-
COMPARATOR
The parameter source extractors comparator by priority. -
DEFAULT_FILTER
The default parameters source extractors filter.Default filter returns all the registered generation parameters source extractors that accept parameters of the specified type
-
DEFAULT_BUILDER
The default parameters extractor builder.Default builder creates a instance of
DefaultParametersExtractor.- See Also:
-
-
Method Details
-
getRegisteredSourceExtractors
@NotNull public static @NotNull List<ParametersSourceExtractor<?,?>> getRegisteredSourceExtractors()Returns an unmodifiable list with the registered parameter source extractors.- Returns:
- The registered parameter source extractors
-
register
Adds the specified parameter source extractors to the registered extractors.- Parameters:
extractors- The parameter source extractors to register
-
register
public static void register(@NotNull @NotNull Collection<ParametersSourceExtractor<?, ?>> extractors) Adds the specified parameter source extractors to the registered extractors.- Parameters:
extractors- The parameter source extractors to register
-
remove
Removes the specified parameter source extractors from the registered extractors.- Parameters:
extractors- The parameter source extractors to remove
-
remove
Removes the specified parameter source extractors from the registered extractors.- Parameters:
extractors- The parameter source extractors to remove
-
reset
public static void reset()Resets the loaded and cached extractors. Next call will regenerate the parameter source extractors list (including SPI extractor) and restart parameter extractors caching. -
getExtractor
Returns a generation parameters extractor for the specified parameters type.The extractor will contain all parameter source extractors suitable for the given parameters type.
- Type Parameters:
P- The target parameters type- Parameters:
parametersType- The target parameters type- Returns:
- The parameters extractor for the target parameters type
-
getFilter
Returns the generation parameters source extractors filter.- Returns:
- The generation parameters source extractors filter
-
setFilter
Sets the generation parameters source extractors filter.- Parameters:
filter- The generation parameters source extractors filter
-
getBuilder
Returns the parameters extractor builder.- Returns:
- The parameters extractor builder
-
setBuilder
Sets the parameters extractor builder.- Parameters:
builder- The parameters extractor builder
-