Class MoneyExpressionVariable
java.lang.Object
com.broadleafcommerce.rulesengine.expression.util.MoneyExpressionVariable
- All Implemented Interfaces:
- ExpressionVariable
Common, null-safe, operations for the 
MonetaryAmount fields.- Author:
- Dima Myroniuk (dmyroniuk)
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionjavax.money.MonetaryAmountResolves a monetary amount from an object map.getName()doubleConverts the object map into a monetary amount and returns the double value of that amount.doubletoDouble(javax.money.MonetaryAmount field) Returns the double value of theMonetaryAmountfield.doubletoDouble(javax.money.MonetaryAmount field, double defaultValue) Returns the double value of theMonetaryAmountfield.
- 
Field Details- 
NAME- See Also:
 
 
- 
- 
Constructor Details- 
MoneyExpressionVariablepublic MoneyExpressionVariable()
 
- 
- 
Method Details- 
getName- Specified by:
- getNamein interface- ExpressionVariable
- Returns:
- Name of the variable, must not be null
 
- 
toDoublepublic double toDouble(@Nullable javax.money.MonetaryAmount field) - Parameters:
- field- MonetaryAmount to convert to double.
- Returns:
- the double value of the MonetaryAmountfield orDouble.MIN_VALUEif null.
 
- 
toDoubleConverts the object map into a monetary amount and returns the double value of that amount. If the monetary amount cannot be resolved, returnsDouble.MIN_VALUE.- Parameters:
- objectMap- the map of the monetary amount object to get the double value of
- Returns:
- the double value of the object map, or Double.MIN_VALUEif it cannot be resolved
 
- 
toDoublepublic double toDouble(@Nullable javax.money.MonetaryAmount field, double defaultValue) Returns the double value of theMonetaryAmountfield. Iffieldis null, returnsdefaultValue.- Parameters:
- field- MonetaryAmount to convert to double.
- defaultValue- Value to default to if- fieldis null
- Returns:
- the double value of the MonetaryAmountfield ordefaultValueif null.
 
- 
fromMapResolves a monetary amount from an object map. This is necessary for cases when JSON has been deserialized as a simple map (i.e.Map<String, Object>), and a monetary amount needs to be retrieved from that object.- Parameters:
- objectMap- the object map to convert the monetary amount from
- Returns:
- the monetary amount, or null if the required information is not present or correct
 
 
-