Class ProductSwitch.ProductSwitchCondition
java.lang.Object
org.faktorips.runtime.productswitch.ProductSwitch.ProductSwitchCondition
- Enclosing class:
- ProductSwitch
This builder class configures the conditions used for finding the correct replacement
IProductComponent.-
Method Summary
Modifier and TypeMethodDescriptionmatchingBy(String attributeName) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the given attribute name of aProductComponentif more than one suitable replacement is found in the product configuration.matchingBy(ProductCmptType productCmptType, String attributeName) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses aProductComponentand an attribute name of the givenProductCmptTypeif more than one suitable replacement is found in the product configuration.switchAt(PolicyAssociation association, AdvancedProductFinder finder) This method allows to register anAdvancedProductFinderwith a specificPolicyAssociation.to(IProductComponent newProduct) The newIProductComponentthat should be used for the switch.with(BiPredicate<IProductComponent, IProductComponent> howToMatch) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the given predicate if more than one suitable replacement is found in the product configuration.with(AdvancedProductFinder finder) This method uses the givenAdvancedProductFinderfor allPolicyAssociations.with(MatchingProductFinder productFinder) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the givenMatchingProductFinder.
-
Method Details
-
with
public ProductSwitch.MatchingProductFinderSwitch with(BiPredicate<IProductComponent, IProductComponent> howToMatch) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the given predicate if more than one suitable replacement is found in the product configuration.- Parameters:
howToMatch- the predicate how theIProductComponentsdetermine if they are suitable for a switch e.g. a configured enum that is used on all switchableIProductComponents- Returns:
- the
MatchingProductFinderSwitchBuilder
-
matchingBy
This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the given attribute name of aProductComponentif more than one suitable replacement is found in the product configuration.- Parameters:
attributeName- the attribute with the given name declared in aProductCmptType- Returns:
- the
MatchingProductFinderSwitchBuilder
-
with
This method will return aProductSwitch.MatchingProductFinderSwitchthat uses the givenMatchingProductFinder.- Parameters:
productFinder- theMatchingProductFinderthat returns anOptionalwith anIProductComponentthat should be used for the switch, orOptional.empty()if no suitable replacement is found in the product configuration- Returns:
- the
MatchingProductFinderSwitchBuilder
-
matchingBy
public ProductSwitch.MatchingProductFinderSwitch matchingBy(ProductCmptType productCmptType, String attributeName) This method will return aProductSwitch.MatchingProductFinderSwitchthat uses aProductComponentand an attribute name of the givenProductCmptTypeif more than one suitable replacement is found in the product configuration.- Parameters:
productCmptType- theProductCmptTypeused to switchattributeName- the attribute with the given name declared in theProductCmptType- Returns:
- the
MatchingProductFinderSwitchBuilder
-
to
The newIProductComponentthat should be used for the switch.- Parameters:
newProduct- the newIProductComponent- Returns:
- an
Mapwith all switchedIConfigurableModelObjectsand their status determined by eitherProductSwitchResults.FailedProductSwitchorProductSwitchResults.SuccessfulProductSwitch.
-
switchAt
public ProductSwitch.MultipleProductSwitchCondition switchAt(PolicyAssociation association, AdvancedProductFinder finder) This method allows to register anAdvancedProductFinderwith a specificPolicyAssociation.- Parameters:
association- the association for which the product finder should be usedfinder- the product finder that should be used- Returns:
- the
MultipleProductSwitchConditionBuilder
-
with
This method uses the givenAdvancedProductFinderfor allPolicyAssociations.- Parameters:
finder- theAdvancedProductFinderto use- Returns:
- the
AdvancedProductFinderSwitchBuilder
-