B
- the builder type (this)T
- the type that the builder will buildpublic interface SdkBuilder<B extends SdkBuilder<B,T>,T> extends Buildable
Modifier and Type | Method and Description |
---|---|
default B |
applyMutation(Consumer<B> mutator)
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 applyMutation(Consumer<B> mutator)
Builder builder = ClassBeingBuilt.builder();
builder = Util.addSomeDetailToTheBuilder(builder);
ClassBeingBuilt clz = builder.build();
This can be done in a statement:
ClassBeingBuilt = ClassBeingBuilt.builder().applyMutation(Util::addSomeDetailToTheBuilder).build();
mutator
- the function that mutates the builderCopyright © 2021. All rights reserved.