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 String
getName()
double
maxDoubleValue()
Returns the max double value.double
minDoubleValue()
Returns the min double value.double
toDouble(BigDecimal field)
Returns the double value of theBigDecimal
field.double
toDouble(BigDecimal field, double defaultValue)
Returns the double value of theBigDecimal
field.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in 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
BigDecimal
field orminDoubleValue()
if null.
-
toDouble
public double toDouble(@Nullable BigDecimal field, double defaultValue)
- Parameters:
field
- BigDecimal to convert to double.defaultValue
- Value to default to iffield
is null- Returns:
- the double value of the
BigDecimal
field ordefaultValue
if 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
-
-