|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
java.math.BigDecimal
org.tentackle.util.BMoney
org.tentackle.util.DMoney
public class DMoney
A DMoney is the same as a BMoney but will be treated
differently when stored in the database.
A BMoney is stored as a DOUBLE for the value and an INTEGER for the scale.
A DMoney is stored as a DECIMAL for the value and an INTEGER for the scale.
The DECIMAL is stored with scale 0!
| Field Summary |
|---|
| Fields inherited from class org.tentackle.util.BMoney |
|---|
currency |
| Fields inherited from class java.math.BigDecimal |
|---|
ONE, ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_UNNECESSARY, ROUND_UP, TEN, ZERO |
| Constructor Summary | |
|---|---|
DMoney()
Creates a zero DMoney with a scale ccording to the currency of the current locale. |
|
DMoney(BigDecimal val)
Creates a DMoney from a BigDecimal (userful for SQL) |
|
DMoney(BigInteger intVal,
int scale)
Creates a DMoney value from a BigInteger. The scale sets the comma within the given integer. |
|
DMoney(BMoney val,
int scale)
Creates a DMoney from a BMoney (useful to rescale) |
|
DMoney(double val,
int scale)
Creates a DMoney value. |
|
DMoney(int scale)
Creates a zero DMoney value. |
|
DMoney(String val,
int scale)
Creates a DMoney value. |
|
| Method Summary | |
|---|---|
DMoney |
absolute()
Gets the absolute value. |
DMoney |
add(BMoney val)
Adds a BMoney to this value and returns a new object. |
DMoney |
divide(double val)
Divides a BMoney by double and returns a new object. |
DMoney |
invert()
Inverts this money value. |
DMoney |
multiply(double val)
Multiplies this BMoney by a double and returns a new object. |
DMoney |
smallestPositive()
Returns the smalles positive value (i.e. |
DMoney |
subtract(BMoney val)
Subtracts a BMoney from this value and returns a new object. |
| Methods inherited from class org.tentackle.util.BMoney |
|---|
alignScale, clone, divide, isNegative, isPositive, isZero, toWords |
| Methods inherited from class java.math.BigDecimal |
|---|
abs, abs, add, add, byteValueExact, compareTo, divide, divide, divide, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideToIntegralValue, divideToIntegralValue, doubleValue, equals, floatValue, hashCode, intValue, intValueExact, longValue, longValueExact, max, min, movePointLeft, movePointRight, multiply, multiply, negate, negate, plus, plus, pow, pow, precision, remainder, remainder, round, scale, scaleByPowerOfTen, setScale, setScale, setScale, shortValueExact, signum, stripTrailingZeros, subtract, subtract, toBigInteger, toBigIntegerExact, toEngineeringString, toPlainString, toString, ulp, unscaledValue, valueOf, valueOf, valueOf |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DMoney(double val,
int scale)
val - double-representation of the numberscale - the digits after comma the value should be rounded to
public DMoney(String val,
int scale)
val - the stringscale - the digits after comma the value should be rounded topublic DMoney(int scale)
scale - the digits after comma
public DMoney(BigInteger intVal,
int scale)
intVal - the big integerscale - the digits after comma
public DMoney(BMoney val,
int scale)
val - the BMoney or DMoney valuescale - the digits after comma the value should be rounded topublic DMoney(BigDecimal val)
val - the decimal valuepublic DMoney()
| Method Detail |
|---|
public DMoney add(BMoney val)
BMoney
add in class BMoneyval - the money value to add
public DMoney subtract(BMoney val)
BMoney
subtract in class BMoneyval - the money value to subtract
public DMoney multiply(double val)
BMoney
multiply in class BMoneyval - the double to multiply with
public DMoney divide(double val)
BMoney
divide in class BMoneyval - the value to divide this BMoney by
public DMoney invert()
BMoney
invert in class BMoneypublic DMoney absolute()
BMoney
absolute in class BMoneypublic DMoney smallestPositive()
BMoney
smallestPositive in class BMoney
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||