T - The target type: an instance of that type is finally built.
That type is expected to be mutable.B - The builder type: the intended effective type of the concrete builder implementation.public class LateBuilder<T,B extends LateBuilder<T,B>> extends BuilderBase<B> implements Setup<T,B>
<B> and as such provides a model that separates basic
builder concepts from the actual target data model <T>.
This implementation can be used as a base if instances of a target type are to be built that is itself mutable but does not itself implement a builder pattern. The builder initially only collects the modifying operations and only applies them to a newly created target instance with build().
| Modifier | Constructor and Description |
|---|---|
protected |
LateBuilder(Supplier<T> newResult,
Class<B> builderClass)
Initializes a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
T |
build()
Returns the build result.
|
B |
setup(Consumer<T> consumer)
Accepts a
Consumer as modifying operation to be performed on a target instance immediately
or no later than the final build() operation and returns the builder instance itself. |
THISprotected LateBuilder(Supplier<T> newResult, Class<B> builderClass)
newResult - A Supplier method to retrieve a new instance of the result type.builderClass - The Class representation of the intended effective builder type.IllegalArgumentException - if the given builder class does not represent this instance.Copyright © 2025 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.