Class PriceModifier
- All Implemented Interfaces:
Serializable
Whereas PriceData
provides a specific price for a PriceableTarget
, 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 by
PriceableFieldProperties
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 the amount
is added, subtracted, multiplied, or a some other
operation to the fieldToModify
. Default supported operations defined in
PriceModificationType
.
- Author:
- Nathan Moore (nathanmoore
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
The amount by which we are modifying the targetString representation of an expression to determine whether this modifier applies to aPriceableTarget
.Name of field to modify.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.toString()
-
Constructor Details
-
PriceModifier
public PriceModifier()
-
-
Method Details
-
getAmount
The amount by which we are modifying the target -
getModificationType
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.- See Also:
-
getCriteria
String representation of an expression to determine whether this modifier applies to aPriceableTarget
. -
getFieldToModify
Name of field to modify. This must match a map key inPriceableTarget.priceableFields
.- See Also:
-
setAmount
The amount by which we are modifying the target -
setModificationType
Type of modification to perform: Addition, Subtraction, Multiplication, Percentage, etc.- See Also:
-
setCriteria
String representation of an expression to determine whether this modifier applies to aPriceableTarget
. -
setFieldToModify
Name of field to modify. This must match a map key inPriceableTarget.priceableFields
.- See Also:
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-