Class DataBuilder<C,T,B extends ProtoBuilder<C,B>>
java.lang.Object
de.team33.patterns.building.elara.BuilderBase<B>
de.team33.patterns.building.elara.ProtoBuilder<C,B>
de.team33.patterns.building.elara.DataBuilder<C,T,B>
- Type Parameters:
C- The core type: an instance of that type is associated with the builder instance to hold the data to be collected during the build process. That type is expected to be mutable, at least in the scope of the concrete builder implementation.T- The target type: an instance of that type will be returned bybuild().B- The builder type: the intended effective type of the concrete builder implementation.
- All Implemented Interfaces:
Setup<C,B>
Serves as a base class for builder implementations
<B> and as such provides a model that separates basic
builder concepts from the actual core data model <C>.
This implementation can be used as a base if an instance of the core type <C> should be linked to the
builder instance from the start, the result of the build process shouldn't necessarily be of the core type and
a mapping exists that converts the core type <C> to the final target type <T>.
Core type <C> and target type <T> may also be the same, but avoid the final result to be identical
to the originally associated target instance (e.g. when using Function.identity() as mapping).
You should prefer Charger in this particular case!
-
Nested Class Summary
Nested classes/interfaces inherited from class de.team33.patterns.building.elara.ProtoBuilder
ProtoBuilder.Lifecycle -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class de.team33.patterns.building.elara.ProtoBuilder
build, setupMethods inherited from class de.team33.patterns.building.elara.BuilderBase
THIS
-
Constructor Details
-
DataBuilder
Initializes a new instance.- Parameters:
core- The core instance to be associated with the builder. The implementation assumes that it is exclusively available to the builder, at least for the course of the build process.mapping- AFunctionto map the associated core to the final target. Even if the core type<C>matches the target type<T>thatFunctionshould create a new target instance (otherwise preferCharger).builderClass- TheClassrepresentation of the intended effective builder type.- Throws:
IllegalArgumentException- if the given builder class does not represent this instance.
-
-
Method Details
-
peek
-
build
Returns the build result.
-