Package me.hsgamer.hscore.builder
Class MassBuilder<I,O>
java.lang.Object
me.hsgamer.hscore.builder.MassBuilder<I,O>
- Type Parameters:
I
- the type of the inputO
- the type of the output
- Direct Known Subclasses:
Builder
,FunctionalMassBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBuild the output from the input.Build the collection of outputs from the inputclear()
Clear all the registered build elementsCollection<Function<I,
Optional<O>>> Get the registered build elementsRegister a new build elementRegister a new build elementRemove a build element
-
Constructor Details
-
MassBuilder
public MassBuilder()
-
-
Method Details
-
register
Register a new build element- Parameters:
element
- the elementaddFirst
- true if you want to add the element to the first of the list- Returns:
- this builder for chaining
-
register
Register a new build element- Parameters:
element
- the element- Returns:
- this builder for chaining
-
remove
Remove a build element- Parameters:
element
- the element- Returns:
- this builder for chaining
-
clear
Clear all the registered build elements- Returns:
- this builder for chaining
-
buildAll
Build the collection of outputs from the input- Parameters:
input
- the input- Returns:
- the collection of outputs
-
build
Build the output from the input. This will find the first build element that can build the input, and return the output. If there is no output, return an empty optional.- Parameters:
input
- the input- Returns:
- the output
-
getElements
Get the registered build elements- Returns:
- the registered build elements
-