Class PriceModifier
- java.lang.Object
-
- com.broadleafcommerce.pricing.domain.PriceModifier
-
- All Implemented Interfaces:
Serializable
public class PriceModifier extends Object implements Serializable
Whereas
PriceData
provides a specific price for aPriceableTarget
, a price modifier performs an operation on a priceable field of the target such as adding 20% of the target's cost to calculate the price.Several priceable fields are defined by default including basePrice, baseCost, standardPrice, salePrice, and contractPrice. BasePrice and baseCost are provided as part of
PriceableTarget.priceableFields
. The map key names are configurable byPriceableFieldProperties
so that each implementor can use their own terminology. For instance, the basePrice could be called 'MSRP' or 'retailPrice'.StandardPrice, salePrice, and contractPrice are derivative prices determined after a standard or sale price list has provided a specific price. That is to say, the standardPrice is usually an override or modification of the basePrice provided by a PriceableEntity. Likewise, the salePrice can be an override or modification of the standardPrice provided by a StandardPriceList, and a contractPrice can override or modify a salePrice provided by a SalePriceList. Consequently, a StandardPriceList's PriceModifier cannot modify a salePrice or contractPrice, neither can a SalePriceList's PriceModifier modify a contractPrice.
The
modificationType
determines whether theamount
is added, subtracted, multiplied, or a some other operation to thefieldToModify
. Default supported operations defined inPriceModificationType
.- Author:
- Nathan Moore (nathanmoore
- See Also:
PriceableFieldProperties
,PriceModificationType
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PriceModifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
BigDecimal
getAmount()
The amount by which we are modifying the targetString
getCriteria()
String representation of an expression to determine whether this modifier applies to aPriceableTarget
.String
getFieldToModify()
Name of field to modify.String
getModificationType()
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.int
hashCode()
void
setAmount(BigDecimal amount)
The amount by which we are modifying the targetvoid
setCriteria(String criteria)
String representation of an expression to determine whether this modifier applies to aPriceableTarget
.void
setFieldToModify(String fieldToModify)
Name of field to modify.void
setModificationType(String modificationType)
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.String
toString()
-
-
-
Method Detail
-
getAmount
public BigDecimal getAmount()
The amount by which we are modifying the target
-
getModificationType
public String getModificationType()
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.- See Also:
PriceModificationType
-
getCriteria
public String getCriteria()
String representation of an expression to determine whether this modifier applies to aPriceableTarget
.
-
getFieldToModify
public String getFieldToModify()
Name of field to modify. This must match a map key inPriceableTarget.priceableFields
.- See Also:
PriceableFieldProperties
-
setAmount
public void setAmount(BigDecimal amount)
The amount by which we are modifying the target
-
setModificationType
public void setModificationType(String modificationType)
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.- See Also:
PriceModificationType
-
setCriteria
public void setCriteria(String criteria)
String representation of an expression to determine whether this modifier applies to aPriceableTarget
.
-
setFieldToModify
public void setFieldToModify(String fieldToModify)
Name of field to modify. This must match a map key inPriceableTarget.priceableFields
.- See Also:
PriceableFieldProperties
-
canEqual
protected boolean canEqual(Object other)
-
-