Order - The type of the product customization.Product - The type of the values to be produced.public interface Producer<Order,Product>
Producer produces customized values of the corresponding product
type. It acts like a Provider that takes orders and produces
corresponding products.
Implementers may produce a new instance of the product each time
produce(Object) is called, but aren't required to do so. An
instance of the product that has already been returned once, may be returned
again for any or all following calls.
A Producer is intended to be used in a situation, where a mechanism
to retrieve a value is more desirable than having the value from the start.
These are usually, but not necessarily, situations where the following two
conditions are met.
The second condition may only be true for the first call to
produce(Object) since the Producer are allowed to
cache and reuse the value.
| Modifier and Type | Method and Description |
|---|---|
Product |
produce(Order order)
Produces a customized product.
|
Product produce(Order order) throws ProductionException
Implementers should catch any exception and wrap them in a
ProductionException.
Implementers may provide a new instance of the product each time this method is called, but aren't required to do so. An instance of the product that has already been returned once, may be returned again in any or all following calls.
order - The order to take into account.ProductionException - If the production of the product failed.Copyright © 2015–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.