java.lang.Object
com.broadleafcommerce.catalog.domain.commerce.PriceInfo
All Implemented Interfaces:
Serializable

public class PriceInfo extends Object implements Serializable
Pricing information for a target (e.g., Product or Variant), providing the target, best price, and some details about the other candidate prices. If the best overall price is a 'sale price', then the details could contain the best standard/retail price if there was one.
Author:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • PriceInfo

      public PriceInfo()
    • PriceInfo

      public PriceInfo(javax.money.MonetaryAmount price, String priceType, Map<String,PriceTypeDetail> priceTypeDetails, String derivedFromFieldType)
  • Method Details

    • from

      public PriceInfo from(PriceInfo origin)
      Copies values from origin to this. If origin is null, then returns this with all values cleared.
      Parameters:
      origin - Original PriceInfo to copy values from.
      Returns:
      this
    • getPrice

      public javax.money.MonetaryAmount getPrice()
      Determined best price for a target.
      Returns:
      Determined best price for a target.
    • getPriceType

      public String getPriceType()
      The type of price whether salePrice, standardPrice, contractPrice, etc.
      Returns:
      The type of price whether salePrice, standardPrice, contractPrice, etc.
    • getPriceTypeDetails

      public Map<String,PriceTypeDetail> getPriceTypeDetails()
      Map of each type of price to each corresponding PriceTypeDetail, which contains the best overall price for that type.
      Returns:
      Map of each type of price to each corresponding PriceTypeDetail
    • getDerivedFromFieldType

      public String getDerivedFromFieldType()
      A PriceInfo can be the result of a formula based pricing algorithm. For example, a sale price might be 10% off of the retail price. For proper sorting by the caller, it can be important to know the way that the price was derived. By default, for price infos and details returned from a formula, the derivedFromField will be either PRICE_DATA_FIELD, VARIANT_BASE_FIELD, or BASE_FIELD.
      Returns:
      Returns one of {"PRICE_DATA_FIELD", "VARIANT_BASE_FIELD", "BASE_FIELD", or null (representing none or unknown}
    • setPrice

      public void setPrice(javax.money.MonetaryAmount price)
      Determined best price for a target.
      Parameters:
      price - Determined best price for a target.
    • setPriceType

      public void setPriceType(String priceType)
      The type of price whether salePrice, standardPrice, contractPrice, etc.
      Parameters:
      priceType - The type of price whether salePrice, standardPrice, contractPrice, etc.
    • setPriceTypeDetails

      public void setPriceTypeDetails(Map<String,PriceTypeDetail> priceTypeDetails)
      Map of each type of price to each corresponding PriceTypeDetail, which contains the best overall price for that type.
      Parameters:
      Map - of each type of price to each corresponding PriceTypeDetail
    • setDerivedFromFieldType

      public void setDerivedFromFieldType(String derivedFromFieldType)
      A PriceInfo can be the result of a formula based pricing algorithm. For example, a sale price might be 10% off of the retail price. For proper sorting by the caller, it can be important to know the way that the price was derived. By default, for price infos and details returned from a formula, the derivedFromField will be either PRICE_DATA_FIELD, VARIANT_BASE_FIELD, or BASE_FIELD.
      Parameters:
      derivedFromField - The type of field used in formula based pricing
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object