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)
  • Field Details

  • Constructor Details

    • DecimalExpressionVariable

      public DecimalExpressionVariable()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface ExpressionVariable
      Returns:
      Name of the variable, must not be null
    • toDouble

      public double toDouble(@Nullable BigDecimal field)
      Returns the double value of the BigDecimal field. If field is null, returns minDoubleValue().
      Parameters:
      field - BigDecimal to convert to double.
      Returns:
      the double value of the BigDecimal field or minDoubleValue() if null.
    • toDouble

      public double toDouble(@Nullable BigDecimal field, double defaultValue)
      Returns the double value of the BigDecimal field. If field is null, returns defaultValue.
      Parameters:
      field - BigDecimal to convert to double.
      defaultValue - Value to default to if field is null
      Returns:
      the double value of the BigDecimal field or defaultValue 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