Module net.finmath.lib
Class ProductFactoryCascade<T extends ProductDescriptor>
- java.lang.Object
-
- net.finmath.modelling.productfactory.ProductFactoryCascade<T>
-
- Type Parameters:
T- The base class of the product descriptors which can be handled by thisProductFactory.
- All Implemented Interfaces:
ProductFactory<T>
public class ProductFactoryCascade<T extends ProductDescriptor> extends Object implements ProductFactory<T>
Implements a product factory based on a cascade of given factories. When invokinggetProductFromDescriptor(ProductDescriptor productDescriptor)the cascade will query all its individual factories until one builds the product. When querying the factories the cascade will start at index 0.- Version:
- 1.0
- Author:
- Christian Fries, Roland Bachl
-
-
Constructor Summary
Constructors Constructor Description ProductFactoryCascade()Construct an empty factory cascade.ProductFactoryCascade(List<ProductFactory<? extends T>> factories)Construct a factory cascade from an ordered list of product factories.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProductFactoryCascade<T>addFactoryAfter(ProductFactory<? extends T> factory)Add a given factory to the list of factories at the END.ProductFactoryCascade<T>addFactoryBefore(ProductFactory<? extends T> factory)Add a given factory to the list of factories at the BEGINNING.DescribedProduct<? extends T>getProductFromDescriptor(ProductDescriptor productDescriptor)Constructs the product from a given product descriptor.
-
-
-
Constructor Detail
-
ProductFactoryCascade
public ProductFactoryCascade()
Construct an empty factory cascade. This will build no products until amended.
-
ProductFactoryCascade
public ProductFactoryCascade(List<ProductFactory<? extends T>> factories)
Construct a factory cascade from an ordered list of product factories. When querying the factories the cascade will start at index 0.- Parameters:
factories- A list of product factories, i.e. object implementingProductFactoryfor the product descriptorT.
-
-
Method Detail
-
addFactoryBefore
public ProductFactoryCascade<T> addFactoryBefore(ProductFactory<? extends T> factory)
Add a given factory to the list of factories at the BEGINNING.- Parameters:
factory- The factory to be added.- Returns:
- Cascade with amended factory list.
-
addFactoryAfter
public ProductFactoryCascade<T> addFactoryAfter(ProductFactory<? extends T> factory)
Add a given factory to the list of factories at the END.- Parameters:
factory- The factory to be added.- Returns:
- Cascade with amended factory list.
-
getProductFromDescriptor
public DescribedProduct<? extends T> getProductFromDescriptor(ProductDescriptor productDescriptor)
Description copied from interface:ProductFactoryConstructs the product from a given product descriptor.- Specified by:
getProductFromDescriptorin interfaceProductFactory<T extends ProductDescriptor>- Parameters:
productDescriptor- A product descriptor.- Returns:
- An instance of the product describable by this descriptor.
-
-