All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.money.currency.v1_0.MoneyCalculator
java.lang.Object
|
+----com.roguewave.money.currency.v1_0.MoneyCalculator
- public class MoneyCalculator
- extends Object
Class MoneyCalculator
can perform algebraic operations when the money operands
in the equation are not necessarily of the same currency. Because some conversion from one
currency to another must occur before such an operation can be carried out,
MoneyCalculator
lets you specify a conversion policy for currency exchange.
Four conversion policies are available. They are described below. Conversions are carried
out through the ExchangeFactory
object that is associated with the particular
calculator object. For a description of rounding methods see the Money
API
documentation.
- Author:
- Trevor Misfeldt
- See Also:
- Money, ExchangeFactory, MoneyCalculatorExample, FactoryExample, GroupExample
-
CONVERSION_BASE
- Base Currency Conversion.
-
CONVERSION_SOURCE
- Source Currency Conversion.
-
CONVERSION_TARGET
- Target Currency Conversion.
-
DEFAULT_BASE
- The default base currency is the US dollar, "USD".
-
DEFAULT_CONVERSION
- The default conversion policy is no conversion.
-
DEFAULT_ROUND_METHOD
- The default rounding method is no rounding.
-
NO_CONVERSION
- No Conversion.
-
MoneyCalculator()
- Creates a new calculator with default rounding, conversion, accuracy and digit.
-
MoneyCalculator(ExchangeFactory)
- Creates a new calculator with the default conversion using the specified
exchange factory and the default rounding method, accuracy and rounding
digit.
-
MoneyCalculator(ExchangeFactory, short)
- Creates a new calculator that uses the specified conversion policy and exchange
factory with the default base currency, rounding method, accuracy and rounding
digit.
-
MoneyCalculator(ExchangeFactory, short, short)
- Creates a new calculator that uses the specified conversion policy, exchange
factory and rounding method with the default base currency, accuracy and
rounding digit.
-
MoneyCalculator(ExchangeFactory, short, short, int)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, rounding method and accuracy with the default base currency and
rounding digit.
-
MoneyCalculator(ExchangeFactory, short, short, int, int)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, rounding method, accuracy and rounding digit with the default base
currency.
-
MoneyCalculator(ExchangeFactory, short, String)
- Creates a new calculator that uses the specified conversion policy, exchange
factory and base currency with the default rounding method, accuracy and
rounding digit.
-
MoneyCalculator(ExchangeFactory, short, String, short)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency and rounding method with the accuracy and rounding
digit.
-
MoneyCalculator(ExchangeFactory, short, String, short, int)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency, rounding method and accuracy with the default rounding
digit.
-
MoneyCalculator(ExchangeFactory, short, String, short, int, int)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency, rounding method, accuracy and rounding digit.
-
MoneyCalculator(ExchangeRateTable)
- Creates a new calculator with the default conversion using the specified
exchange rate table and the default rounding method, accuracy and rounding
digit.
-
MoneyCalculator(ExchangeRateTable, short)
- Creates a new calculator that uses the specified conversion policy and exchange
rate table with the default base currency, rounding method, accuracy and
rounding digit.
-
MoneyCalculator(ExchangeRateTable, short, short)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table and rounding method with the default base currency, accuracy and
rounding digit.
-
MoneyCalculator(ExchangeRateTable, short, short, int)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, rounding method and accuracy with the default base currency and
rounding digit.
-
MoneyCalculator(ExchangeRateTable, short, short, int, int)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, rounding method, accuracy and rounding digit with the default base
currency.
-
MoneyCalculator(ExchangeRateTable, short, String)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table and base currency with the default rounding method, accuracy and
rounding digit.
-
MoneyCalculator(ExchangeRateTable, short, String, short)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency and rounding method with the accuracy and rounding
digit.
-
MoneyCalculator(ExchangeRateTable, short, String, short, int)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency, rounding method and accuracy with the default
rounding digit.
-
MoneyCalculator(ExchangeRateTable, short, String, short, int, int)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency, rounding method, accuracy and rounding digit.
-
MoneyCalculator(short, int)
- Creates a new calculator with the desired rounding method and accuracy and with
the default conversion policy and rounding digit.
-
MoneyCalculator(short, int, int)
- Creates a new calculator with the desired rounding method, accuracy and
rounding digit.
-
abs(Money)
- Returns a new money which has the absolute value of the money's amount.
-
add(Money, Money)
- Returns a new money which is the sum of the two money objects.
-
divide(Money, BigDecimal)
- Returns a new money which is the quotient of the money and the decimal
divisor.
-
divide(Money, double)
- Returns a new money which is the quotient of the money and the floating
point divisor.
-
equals(Money, Money)
- Returns true if the first money is equal to the second money.
-
getAccuracy()
- Returns the accuracy (the number of places following the decimal position).
-
getBaseCurrency()
- Returns the base currency.
-
getConversionPolicy()
- Returns the currency conversion policy.
-
getExchangeFactory()
- Returns the currency exchange factory.
-
getRoundDigit()
- Returns the rounding digit.
-
getRoundMethod()
- Returns the current rounding method.
-
greaterThan(Money, Money)
- Returns true if the first money is greater than the second money.
-
greaterThanOrEquals(Money, Money)
- Returns true if the first money is greater than or equal to the second
money.
-
greaterThanZero(Money)
- Returns true if the money's amount is greater than zero.
-
isZero(Money)
- Returns true if the money's amount is zero.
-
lessThan(Money, Money)
- Returns true if the first money is less than the second money.
-
lessThanOrEquals(Money, Money)
- Returns true if the first money is less than or equal to the second
money.
-
lessThanZero(Money)
- Returns true if the money's amount is less than zero.
-
multiply(Money, BigDecimal)
- Returns a new money which is the product of the money and the decimal value.
-
multiply(Money, double)
- Returns a new money which is the product of the money and the floating
point value.
-
negate(Money)
- Returns a new money which has the negation of the money's amount.
-
round(Money)
- Returns a new rounded version of the specified money.
-
sameCurrency(Money, Money)
- Returns true if the two money objects have the same currency.
-
setAccuracy(int)
- Sets the accuracy (the desired number of places to the right of the decimal point).
-
setBaseCurrency(String)
- Sets the base currency.
-
setConversionPolicy(short)
- Sets the currency conversion policy.
-
setExchangeFactory(ExchangeFactory)
- Sets the exchange factory which will be used for currency conversions.
-
setRoundDigit(int)
- Sets the rounding digit which comes into play during plain and bankers rounding.
-
setRoundMethod(short)
- Sets the current rounding method.
-
subtract(Money, Money)
- Returns a new money which is the difference between the two
money objects.
DEFAULT_BASE
public static final String DEFAULT_BASE
- The default base currency is the US dollar, "USD".
NO_CONVERSION
public static final short NO_CONVERSION
- No Conversion. Any operations performed on monies of different currencies will cause the
error handler to be invoked.
CONVERSION_BASE
public static final short CONVERSION_BASE
- Base Currency Conversion. When arithmetic operations are performed on monies of different
currencies both operands will first be converted to the base currency. The operation will
then be performed and the result returned in the base currency.
CONVERSION_SOURCE
public static final short CONVERSION_SOURCE
- Source Currency Conversion. When arithmetic operations are performed on monies of different
currencies, the target operand (second argument) is converted to the source operand (first
argument) currency and the result is returned in the source currency.
CONVERSION_TARGET
public static final short CONVERSION_TARGET
- Target Currency Conversion. When arithmetic operations are performed on monies of different
currencies, the source operand (first argument) is converted to the target operand (second
argument) currency and the result is returned in the target currency.
DEFAULT_CONVERSION
public static final short DEFAULT_CONVERSION
- The default conversion policy is no conversion.
- See Also:
- NO_CONVERSION
DEFAULT_ROUND_METHOD
public static final short DEFAULT_ROUND_METHOD
- The default rounding method is no rounding.
- See Also:
- NO_ROUND
MoneyCalculator
public MoneyCalculator()
- Creates a new calculator with default rounding, conversion, accuracy and digit.
- See Also:
- DEFAULT_ROUND_METHOD, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_CONVERSION
MoneyCalculator
public MoneyCalculator(short method,
int accuracy)
- Creates a new calculator with the desired rounding method and accuracy and with
the default conversion policy and rounding digit.
- Parameters:
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- See Also:
- ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_CONVERSION
MoneyCalculator
public MoneyCalculator(short method,
int accuracy,
int digit)
- Creates a new calculator with the desired rounding method, accuracy and
rounding digit.
- Parameters:
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- digit - the desired rounding digit
- See Also:
- ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_CONVERSION
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table)
- Creates a new calculator with the default conversion using the specified
exchange rate table and the default rounding method, accuracy and rounding
digit.
- Parameters:
- table - the exchange rate table
- See Also:
- ExchangeRateTable, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD, DEFAULT_CONVERSION
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy)
- Creates a new calculator that uses the specified conversion policy and exchange
rate table with the default base currency, rounding method, accuracy and
rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
String base)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table and base currency with the default rounding method, accuracy and
rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- base - the desired base currency
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
short method)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table and rounding method with the default base currency, accuracy and
rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- method - the desired rounding method
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
short method,
int accuracy)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, rounding method and accuracy with the default base currency and
rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_BASE
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
short method,
int accuracy,
int digit)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, rounding method, accuracy and rounding digit with the default base
currency.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- digit - the desired rounding digit
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_BASE
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
String base,
short method)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency and rounding method with the accuracy and rounding
digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
String base,
short method,
int accuracy)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency, rounding method and accuracy with the default
rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeRateTable table,
short policy,
String base,
short method,
int accuracy,
int digit)
- Creates a new calculator that uses the specified conversion policy, exchange
rate table, base currency, rounding method, accuracy and rounding digit.
- Parameters:
- table - the exchange rate table
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- digit - the desired rounding digit
- See Also:
- ExchangeRateTable, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory)
- Creates a new calculator with the default conversion using the specified
exchange factory and the default rounding method, accuracy and rounding
digit.
- Parameters:
- factory - the exchange rate factory
- See Also:
- ExchangeFactory, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD, DEFAULT_CONVERSION
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy)
- Creates a new calculator that uses the specified conversion policy and exchange
factory with the default base currency, rounding method, accuracy and rounding
digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
String base)
- Creates a new calculator that uses the specified conversion policy, exchange
factory and base currency with the default rounding method, accuracy and
rounding digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- base - the desired base currency
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_ACCURACY, DEFAULT_DIGIT, DEFAULT_ROUND_METHOD
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
short method)
- Creates a new calculator that uses the specified conversion policy, exchange
factory and rounding method with the default base currency, accuracy and
rounding digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- method - the desired rounding method
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_BASE, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
short method,
int accuracy)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, rounding method and accuracy with the default base currency and
rounding digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT, DEFAULT_BASE
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
short method,
int accuracy,
int digit)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, rounding method, accuracy and rounding digit with the default base
currency.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- digit - the desired rounding digit
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_BASE
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
String base,
short method)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency and rounding method with the accuracy and rounding
digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_ACCURACY, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
String base,
short method,
int accuracy)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency, rounding method and accuracy with the default rounding
digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND, DEFAULT_DIGIT
MoneyCalculator
public MoneyCalculator(ExchangeFactory factory,
short policy,
String base,
short method,
int accuracy,
int digit)
- Creates a new calculator that uses the specified conversion policy, exchange
factory, base currency, rounding method, accuracy and rounding digit.
- Parameters:
- factory - the exchange factory
- policy - the desired conversion policy
- base - the desired base currency
- method - the desired rounding method
- accuracy - the desired accuracy (the number of digits following the decimal
point)
- digit - the desired rounding digit
- See Also:
- ExchangeFactory, NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
getRoundDigit
public int getRoundDigit()
- Returns the rounding digit. That is, the determining digit for plain and bankers rounding.
- Returns:
- the digit
- See Also:
- ROUND_PLAIN, ROUND_BANKERS, DEFAULT_DIGIT
setRoundDigit
public void setRoundDigit(int digit)
- Sets the rounding digit which comes into play during plain and bankers rounding.
- Parameters:
- digit - the rounding digit.
- See Also:
- ROUND_PLAIN, ROUND_BANKERS, DEFAULT_DIGIT
getAccuracy
public int getAccuracy()
- Returns the accuracy (the number of places following the decimal position).
- Returns:
- the accuracy
- See Also:
- DEFAULT_ACCURACY
setAccuracy
public void setAccuracy(int accuracy)
- Sets the accuracy (the desired number of places to the right of the decimal point).
- Parameters:
- accuracy - the desired accuracy
- See Also:
- DEFAULT_ACCURACY
getConversionPolicy
public short getConversionPolicy()
- Returns the currency conversion policy.
- Returns:
- the type
- See Also:
- NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_CONVERSION
setConversionPolicy
public void setConversionPolicy(short policy)
- Sets the currency conversion policy.
- Parameters:
- policy - the desired conversion policy
- See Also:
- NO_CONVERSION, CONVERSION_BASE, CONVERSION_SOURCE, CONVERSION_TARGET, DEFAULT_CONVERSION
getRoundMethod
public short getRoundMethod()
- Returns the current rounding method.
- Returns:
- the method
- See Also:
- ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
setRoundMethod
public void setRoundMethod(short method)
- Sets the current rounding method.
- Parameters:
- method - the desired rounding method
- See Also:
- ROUND_PLAIN, ROUND_UP, ROUND_DOWN, ROUND_BANKERS, NO_ROUND
getExchangeFactory
public ExchangeFactory getExchangeFactory()
- Returns the currency exchange factory.
- Returns:
- the factory
- See Also:
- ExchangeFactory
setExchangeFactory
public void setExchangeFactory(ExchangeFactory factory)
- Sets the exchange factory which will be used for currency conversions.
- Parameters:
- factory - the desired exchange factory
- See Also:
- ExchangeFactory
getBaseCurrency
public String getBaseCurrency()
- Returns the base currency. This only becomes relevant if the conversion
policy is set to '
CONVERSION_BASE
'.
- See Also:
- CONVERSION_BASE, DEFAULT_BASE
setBaseCurrency
public void setBaseCurrency(String currency)
- Sets the base currency. This only becomes relevant if the conversion
policy is set to '
CONVERSION_BASE
'.
- Parameters:
- currency - the desired base currency
- See Also:
- CONVERSION_BASE, DEFAULT_BASE
sameCurrency
public boolean sameCurrency(Money money1,
Money money2)
- Returns true if the two money objects have the same currency.
- Returns:
- whether the currencies are equal or not
- See Also:
- Money, Currency
multiply
public Money multiply(Money money,
double operand)
- Returns a new money which is the product of the money and the floating
point value.
- Parameters:
- money - the money operand
- amount - the floating point operand
- Returns:
- the product
- See Also:
- Money
multiply
public Money multiply(Money money,
BigDecimal operand)
- Returns a new money which is the product of the money and the decimal value.
- Parameters:
- money - the money operand
- amount - the decimal operand
- Returns:
- the product
- See Also:
- Money
divide
public Money divide(Money money,
double operand)
- Returns a new money which is the quotient of the money and the floating
point divisor.
- Parameters:
- money - the money operand
- amount - the floating point divisor
- Returns:
- the quotient
- See Also:
- Money
divide
public Money divide(Money money,
BigDecimal operand)
- Returns a new money which is the quotient of the money and the decimal
divisor.
- Parameters:
- money - the money operand
- amount - the decimal divisor
- Returns:
- the quotient
- See Also:
- Money
abs
public Money abs(Money money)
- Returns a new money which has the absolute value of the money's amount.
- Returns:
- the absolute value
- See Also:
- Money
negate
public Money negate(Money money)
- Returns a new money which has the negation of the money's amount.
- Returns:
- the negation
- See Also:
- Money
lessThan
public boolean lessThan(Money money1,
Money money2)
- Returns true if the first money is less than the second money. Converts the
currencies according to the given conversion policy and base currency. If
the two currencies are not equal after conversion then the error handler is
called.
- Parameters:
- money - the first money
- money - the second money
- Returns:
- whether the first money is less than the second
lessThanOrEquals
public boolean lessThanOrEquals(Money money1,
Money money2)
- Returns true if the first money is less than or equal to the second
money. Converts the currencies according to the given conversion
policy and base currency. If the two currencies are not equal after
conversion then the error handler is called.
- Parameters:
- money - the first money
- money - the second money
- Returns:
- whether the first money is less than or equal to the second
greaterThan
public boolean greaterThan(Money money1,
Money money2)
- Returns true if the first money is greater than the second money. Converts the
currencies according to the given conversion policy and base currency. If
the two currencies are not equal after conversion then the error handler is
called.
- Parameters:
- money - the first money
- money - the second money
- Returns:
- whether the first money is greater than the second
greaterThanOrEquals
public boolean greaterThanOrEquals(Money money1,
Money money2)
- Returns true if the first money is greater than or equal to the second
money. Converts the currencies according to the given conversion
policy and base currency. If the two currencies are not equal after
conversion then the error handler is called.
- Parameters:
- money - the first money
- money - the second money
- Returns:
- whether the first money is greater than or equal to the second
equals
public boolean equals(Money money1,
Money money2)
- Returns true if the first money is equal to the second money. Converts
the currencies according to the given conversion policy and base currency.
If the two currencies are not equal after conversion then the error
handler is called.
- Parameters:
- money - the first money
- money - the second money
- Returns:
- whether the first money is equal to the second
greaterThanZero
public boolean greaterThanZero(Money money)
- Returns true if the money's amount is greater than zero.
- Parameters:
- money - the money for comparison
- Returns:
- whether this money's amount is greater than zero
lessThanZero
public boolean lessThanZero(Money money)
- Returns true if the money's amount is less than zero.
- Parameters:
- money - the money for comparison
- Returns:
- whether this money's amount is less than zero
isZero
public boolean isZero(Money money)
- Returns true if the money's amount is zero.
- Parameters:
- money - the money for comparison
- Returns:
- whether this money's amount equals zero or not
round
public Money round(Money money)
- Returns a new rounded version of the specified money. Uses the specified
rounding policy, accuracy and digit.
- Parameters:
- money - money to be rounded
- Returns:
- rounded money
add
public Money add(Money money1,
Money money2)
- Returns a new money which is the sum of the two money objects.
Converts the currencies if requested and necessary.
- Parameters:
- money - the first operand
- money - the second operand
- Returns:
- the sum
- See Also:
- Money
subtract
public Money subtract(Money money1,
Money money2)
- Returns a new money which is the difference between the two
money objects. Converts the currencies if requested and
necessary.
- Parameters:
- money - the first operand
- money - the second operand
- Returns:
- the difference
- See Also:
- Money
All Packages Class Hierarchy This Package Previous Next Index