atg.commerce.pricing
Class QuantityAggregator
java.lang.Object
atg.commerce.pricing.Aggregator
atg.commerce.pricing.PropertyAggregator
atg.commerce.pricing.QuantityAggregator
public class QuantityAggregator
- extends PropertyAggregator
An implementation of the Aggregator class. The QuantityAggregator is a special case as we need to consider backwards
compatibility. The formula for calculating the aggregated value differs from that of the PropertyAggregator, hence
the reason for needing to create an explicit aggregator for this task.
Field Summary |
static java.lang.String |
CLASS_VERSION
Class version string |
Method Summary |
protected AggregatorInfo |
calculate(java.lang.String pOperation,
java.lang.Double pAggValueSoFar,
java.lang.Long pQuantityMatched,
java.lang.Double pTargetValue,
CommerceItem pItem,
java.util.Map pAttributes)
This method will calculate (based on the given operation) an aggregated value using pItem. |
java.lang.Number |
parseValue(java.lang.String pValue,
java.lang.Class<?> pType)
Parses a string value and returns a Number representation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CLASS_VERSION
public static java.lang.String CLASS_VERSION
- Class version string
QuantityAggregator
public QuantityAggregator()
calculate
protected AggregatorInfo calculate(java.lang.String pOperation,
java.lang.Double pAggValueSoFar,
java.lang.Long pQuantityMatched,
java.lang.Double pTargetValue,
CommerceItem pItem,
java.util.Map pAttributes)
throws PricingException
- This method will calculate (based on the given operation) an aggregated value using pItem.
- Overrides:
calculate
in class PropertyAggregator
- Parameters:
pOperation
- the operation to invoke on the aggregatorpAggValueSoFar
- the aggregated value so far, which may be potentially
derived from many calculations from multiple itemspQuantityMatched
- the number of items that have contributed to the
aggregated valuepTargetValue
- a value specified in the condition/offer of a promotion
which can be used as a target in relation to the aggregated value.
May or may not be relevant to an aggregatorpItem
- the item that is currently being evaluatedpAttributes
- extra parameters
- Returns:
- holds amended aggValueSoFar and quantityMatched values
- Throws:
PricingException
parseValue
public java.lang.Number parseValue(java.lang.String pValue,
java.lang.Class<?> pType)
throws java.lang.NumberFormatException
- Parses a string value and returns a Number representation.
- Overrides:
parseValue
in class PropertyAggregator
- Parameters:
pValue
- value to be parsedpType
- class type of pValue
- Returns:
- parsed value
- Throws:
java.lang.NumberFormatException
- if pValue could not be parsed