Customization - The type of the product customization.Product - The type of the values to be produced.public interface CustomizingProducer<Customization,Product>
CustomizingProducer produces customized values of the corresponding
product type.
Implementers must produce a new instance of the product, each time
produce(Object) is called.
It is therefore okay to use Producers for
products that are stateful.
Producers are intended to be used in
situatuation, where a mechanism to retreive a value is more desirable than
having the value from the start and a Provider is not sufficient
(i.e. because the product is stateful).
Producers ar espacially helpful, if it is likely
that multiple instances of a stateful product will be used (i.e. multiple
Iterators over the same underlying data). Another use case
where a CustomizingProducer may be more favourable than a {qlink
Provider} is, if it is not desirable to keep the value in memory.
CustomizingProvider,
Producer| Modifier and Type | Method and Description |
|---|---|
Product |
produce(Customization customization)
Produces a new customized product.
|
Product produce(Customization customization) throws ProductionException
Implementers must produce a new instance of the product, each time this method is called.
It lies in the responsibility of the caller, to handle unwanted
null-values by replacing them with a sensible default value or
throwing a NullPointerException.
Implementers should catch any exception and wrap them in a
ProductionException.
customization - The customization to take into account.ProductionException - If the production of the product failed.Copyright © 2015–2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.