public class DefaultJcrCartEntry extends java.lang.Object implements CommerceSession.CartEntry
CommerceSession.CartEntry used by
AbstractJcrCommerceSession.
Implementations requiring customization should extend this class and override
AbstractJcrCommerceService.newCartEntryImpl(int, com.adobe.cq.commerce.api.Product, int)
to return said extension.| Constructor and Description |
|---|
DefaultJcrCartEntry(int index,
Product product,
int quantity) |
| Modifier and Type | Method and Description |
|---|---|
int |
getEntryIndex() |
java.lang.String |
getPreTaxPrice()
Deprecated.
|
java.lang.String |
getPrice(Predicate filter)
Shortcut for getting a formatted string of the first matching price.
|
java.util.List<PriceInfo> |
getPriceInfo(Predicate filter)
Get a list of detailed price info objects for a cart entry filtered by the provided
predicate (usually a
PriceFilter). |
Product |
getProduct() |
ValueMap |
getProperties()
Returns the properties of this cart entry or an empty map if there are no properties.
|
<T> T |
getProperty(java.lang.String name,
java.lang.Class<T> type)
Get a cart entry property with the given type.
|
int |
getQuantity() |
java.lang.String |
getTax()
Deprecated.
|
java.lang.String |
getTotalPrice()
Deprecated.
|
java.lang.String |
getUnitPrice()
Deprecated.
|
void |
setEntryIndex(int index) |
void |
setPrice(PriceInfo priceInfo,
java.lang.String... types)
A helper routine which updates the cart entry prices with a new
PriceInfo. |
void |
setQuantity(int quantity) |
public DefaultJcrCartEntry(int index,
Product product,
int quantity)
public int getEntryIndex()
getEntryIndex in interface CommerceSession.CartEntrypublic void setEntryIndex(int index)
public Product getProduct() throws CommerceException
getProduct in interface CommerceSession.CartEntryProduct for this entryCommerceExceptionpublic int getQuantity()
getQuantity in interface CommerceSession.CartEntrypublic void setQuantity(int quantity)
public java.util.List<PriceInfo> getPriceInfo(Predicate filter) throws CommerceException
CommerceSession.CartEntryGet a list of detailed price info objects for a cart entry filtered by the provided
predicate (usually a PriceFilter).
Current components expect price infos with (at least) the following classifiers, in this order:
Example: to get the unit price of a cart entry, you could use the following statement:
cartEntry.getPriceInfo(new PriceFilter("UNIT"));
getPriceInfo in interface CommerceSession.CartEntryfilter - An optional predicate used for filtering the PriceInfos.
Pass null to fetch all PriceInfos.CommerceExceptionPriceFilterpublic java.lang.String getPrice(Predicate filter) throws CommerceException
CommerceSession.CartEntrygetPrice in interface CommerceSession.CartEntryfilter - An optional predicate used for filtering the PriceInfos.CommerceExceptionCommerceSession.CartEntry.getPriceInfo(Predicate)public void setPrice(PriceInfo priceInfo, java.lang.String... types)
PriceInfo. If all
the priceInfo's types match an existing entry, the entry will be updated.
Note: automatically add the priceInfo's currencyCode as an additional tag to ease filtering on currency.
priceInfo - A PriceInfo containing the amount and currency.types - Classifiers indicating the usage of the PriceInfo (ie: "UNIT", "PRE_TAX").public <T> T getProperty(java.lang.String name,
java.lang.Class<T> type)
CommerceSession.CartEntrygetProperty in interface CommerceSession.CartEntryname - The property's nametype - The property's typenull if it doesn't exist
or can not be converted to the given type.public ValueMap getProperties()
@Deprecated public java.lang.String getUnitPrice()
getUnitPrice in interface CommerceSession.CartEntry@Deprecated public java.lang.String getPreTaxPrice()
getPreTaxPrice in interface CommerceSession.CartEntry@Deprecated public java.lang.String getTax()
getTax in interface CommerceSession.CartEntry@Deprecated public java.lang.String getTotalPrice()
getTotalPrice in interface CommerceSession.CartEntryCopyright © 2010 - 2023 Adobe. All Rights Reserved