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 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 Details

    • PriceModifier

      public PriceModifier()
  • Method Details

    • 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:
    • getCriteria

      public String getCriteria()
      String representation of an expression to determine whether this modifier applies to a PriceableTarget.
    • getFieldToModify

      public String getFieldToModify()
      Name of field to modify. This must match a map key in PriceableTarget.priceableFields.
      See Also:
    • 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:
    • setCriteria

      public void setCriteria(String criteria)
      String representation of an expression to determine whether this modifier applies to a PriceableTarget.
    • setFieldToModify

      public void setFieldToModify(String fieldToModify)
      Name of field to modify. This must match a map key in PriceableTarget.priceableFields.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object