/** * Constructor */ public DecimalDt(String theValue) { setValue(new BigDecimal(theValue)); }
/** * Sets a new value using an integer */ public void setValueAsInteger(int theValue) { setValue(new BigDecimal(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") long theValue) { setValue(new BigDecimal(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") double theValue) { // Use the valueOf here because the constructor gives crazy precision // changes due to the floating point conversion setValue(BigDecimal.valueOf(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") BigDecimal theValue) { setValue(theValue); }
/** * Rounds the value to the given prevision * * @see MathContext#getPrecision() * @see MathContext#getRoundingMode() */ public void round(int thePrecision, RoundingMode theRoundingMode) { if (getValue() != null) { BigDecimal newValue = getValue().round(new MathContext(thePrecision, theRoundingMode)); setValue(newValue); } }
/** * Rounds the value to the given prevision * * @see MathContext#getPrecision() */ public void round(int thePrecision) { if (getValue() != null) { BigDecimal newValue = getValue().round(new MathContext(thePrecision)); setValue(newValue); } }
/** * Sets a new value using an integer */ public void setValueAsInteger(int theValue) { setValue(new BigDecimal(theValue)); }
/** * Constructor */ public DecimalDt(String theValue) { setValue(new BigDecimal(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") double theValue) { // Use the valueOf here because the constructor gives crazy precision // changes due to the floating point conversion setValue(BigDecimal.valueOf(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") long theValue) { setValue(new BigDecimal(theValue)); }
/** * Constructor */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") BigDecimal theValue) { setValue(theValue); }
/** * Rounds the value to the given prevision * * @see MathContext#getPrecision() * @see MathContext#getRoundingMode() */ public void round(int thePrecision, RoundingMode theRoundingMode) { if (getValue() != null) { BigDecimal newValue = getValue().round(new MathContext(thePrecision, theRoundingMode)); setValue(newValue); } }
/** * Rounds the value to the given prevision * * @see MathContext#getPrecision() */ public void round(int thePrecision) { if (getValue() != null) { BigDecimal newValue = getValue().round(new MathContext(thePrecision)); setValue(newValue); } }