Class Charger<T,C extends Charger<T,C>>
java.lang.Object
de.team33.patterns.building.elara.BuilderBase<B>
de.team33.patterns.building.elara.ProtoBuilder<T,C>
de.team33.patterns.building.elara.Charger<T,C>
- Type Parameters:
T- The target type: an instance of that type is associated with the charger 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 charger implementation.C- The charger type: the intended effective type of the concrete charger implementation.
- All Implemented Interfaces:
Setup<T,C>
Serves as a base class for builder-like charger implementations
<C> 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 an instance of the target type should be associated with the charger instance from the start and also be used as the result of the charging process.
An instance of this charger type is limited to single use.
Once the terminating charged() method has been used, subsequent calls to Setup.setup(Consumer) throw an
IllegalStateException.
-
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
-
Charger
Initializes a new instance.- Parameters:
target- The target instance to be associated with the charger. The implementation assumes that it is exclusively available to the charger for the course of the build process.chargerClass- TheClassrepresentation of the intended effective charger type.- Throws:
IllegalArgumentException- if the given charger class does not represent this instance.
-
-
Method Details
-
charged
Returns the associated target instance.Subsequent calls of
Setup.setup(Consumer)will lead to anIllegalStateException!
-