T - the type that the builder will buildB - the builder type (this)public interface SdkBuilder<B extends SdkBuilder<B,T>,T>
| Modifier and Type | Method and Description |
|---|---|
default B |
apply(UnaryOperator<B> function)
A convenience operator that takes something that will
mutate the builder in some way and allows inclusion of it
in chaining operations.
|
T |
build()
An immutable object that is created from the
properties that have been set on the builder.
|
T build()
default B apply(UnaryOperator<B> function)
Builder builder = ClassBeingBuilt.builder();
builder = Util.addSomeDetailToTheBuilder(builder);
ClassBeingBuilt clz = builder.build();
This can be done in a statement:
ClassBeingBuilt = ClassBeingBuilt.builder().apply(Util::addSomeDetailToTheBuilder).build();
function - the function that mutates and then returns the builderCopyright © 2017. All rights reserved.