public final class Builder<B,R>
extends java.lang.Object
Predicate validator to validate buildFn function before constructing the result.
The class is typed with two generic types.
B the domain buildFn class.
R the domain results class generated from the domain buildFn.
| Modifier and Type | Method and Description |
|---|---|
R |
build()
Creates the domain buildFn, applies all the operations defined and then generates the domain results class.
|
static <B,R> Builder<B,R> |
instanceOf(java.util.function.Supplier<B> creator,
java.util.function.Function<B,R> builder)
Creates an instance of the Builder given creater and buildFn functions.
|
static <B,R> Builder<B,R> |
instanceOf(java.util.function.Supplier<B> creator,
java.util.function.Predicate<B> validator,
java.util.function.Function<B,R> builder)
Creates an instance of the Builder given creater, validator and buildFn functions.
|
<U> Builder<B,R> |
with(java.util.function.BiConsumer<B,U> consumer,
U value)
Defines an operation and value to be applied to the domain buildFn class.
|
public static <B,R> Builder<B,R> instanceOf(java.util.function.Supplier<B> creator, java.util.function.Function<B,R> builder)
B - domain buildFn classR - domain results classcreator - Supplier to generate the domain buildFn class.builder - Function to generate the domain results class from the domain buildFn class.public static <B,R> Builder<B,R> instanceOf(java.util.function.Supplier<B> creator, java.util.function.Predicate<B> validator, java.util.function.Function<B,R> builder)
B - domain buildFn classR - domain results classcreator - Supplier to generate the domain buildFn class.validator - Predicate to validate the domain buildFn class.builder - Function to generate the domain results class from the domain buildFn class.public <U> Builder<B,R> with(java.util.function.BiConsumer<B,U> consumer, U value)
U - Type of valueconsumer - consumer methodvalue - Value to be applied to the consumerpublic R build()