/** * Checks if the value of this object is a boolean or numeric value. * * @return <code>true</code> if the value is a boolean or number, otherwise <code>false</code> */ public boolean isBooleanOrNumeric() { return isBooleanValue(value) || NumberUtils.isNumber(value); }
/** * Returns the value as a {@link Double} value. The returned value will be <code>0</code> or * <code>1</code> if the {@link #value} is a boolean value. If {@link #value} can not be * converted into a number, a {@link NumberFormatException} is thrown. * * @return {@link #value} as {@link Double} */ public double getValueAsDouble() { if (NumberUtils.isNumber(value)) { return NumberUtils.createDouble(value); } if (isBooleanValue(value)) { return BooleanUtils.toBoolean(value) ? 1 : 0; } throw new NumberFormatException(); }