Class DecimalExpressionVariable
- java.lang.Object
-
- com.broadleafcommerce.rulesengine.expression.util.DecimalExpressionVariable
-
- All Implemented Interfaces:
ExpressionVariable
public class DecimalExpressionVariable extends Object implements ExpressionVariable
Common, null-safe, decimal operations.- Author:
- Nathan Moore (nathandmoore)
-
-
Constructor Summary
Constructors Constructor Description DecimalExpressionVariable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()doublemaxDoubleValue()Returns the max double value.doubleminDoubleValue()Returns the min double value.doubletoDouble(BigDecimal field)Returns the double value of theBigDecimalfield.doubletoDouble(BigDecimal field, double defaultValue)Returns the double value of theBigDecimalfield.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceExpressionVariable- Returns:
- Name of the variable, must not be null
-
toDouble
public double toDouble(@Nullable BigDecimal field)- Parameters:
field- BigDecimal to convert to double.- Returns:
- the double value of the
BigDecimalfield orminDoubleValue()if null.
-
toDouble
public double toDouble(@Nullable BigDecimal field, double defaultValue)- Parameters:
field- BigDecimal to convert to double.defaultValue- Value to default to iffieldis null- Returns:
- the double value of the
BigDecimalfield ordefaultValueif null.
-
maxDoubleValue
public double maxDoubleValue()
Returns the max double value.- Returns:
Double.MAX_VALUE
-
minDoubleValue
public double minDoubleValue()
Returns the min double value.- Returns:
Double.MIN_VALUE
-
-