Class PriceInfo
java.lang.Object
com.broadleafcommerce.catalog.domain.commerce.PriceInfo
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanCopies values fromorigintothis.A PriceInfo can be the result of a formula based pricing algorithm.javax.money.MonetaryAmountgetPrice()Determined best price for a target.The type ofpricewhether salePrice, standardPrice, contractPrice, etc.Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type.inthashCode()voidsetDerivedFromFieldType(String derivedFromFieldType) A PriceInfo can be the result of a formula based pricing algorithm.voidsetPrice(javax.money.MonetaryAmount price) Determined best price for a target.voidsetPriceType(String priceType) The type ofpricewhether salePrice, standardPrice, contractPrice, etc.voidsetPriceTypeDetails(Map<String, PriceTypeDetail> priceTypeDetails) Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type.toString()
-
Constructor Details
-
PriceInfo
public PriceInfo() -
PriceInfo
public PriceInfo(javax.money.MonetaryAmount price, String priceType, Map<String, PriceTypeDetail> priceTypeDetails, String derivedFromFieldType)
-
-
Method Details
-
from
Copies values fromorigintothis. Iforiginis null, then returnsthiswith all values cleared.- Parameters:
origin- OriginalPriceInfoto 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
The type ofpricewhether salePrice, standardPrice, contractPrice, etc.- Returns:
- The type of
pricewhether salePrice, standardPrice, contractPrice, etc.
-
getPriceTypeDetails
Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type.- Returns:
- Map of each type of price to each corresponding
PriceTypeDetail
-
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
The type ofpricewhether salePrice, standardPrice, contractPrice, etc.- Parameters:
priceType- The type ofpricewhether salePrice, standardPrice, contractPrice, etc.
-
setPriceTypeDetails
Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type.- Parameters:
Map- of each type of price to each correspondingPriceTypeDetail
-
setDerivedFromFieldType
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
-
canEqual
-
hashCode
public int hashCode() -
toString
-