All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.money.currency.v1_0.MoneyException
java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----com.roguewave.money.currency.v1_0.MoneyException
- public abstract class MoneyException
- extends RuntimeException
MoneyException
is the abstract base class of all of the
Money.h++ Java exceptions. All derivatives have, at a minimum, a way
of returning a string representation, a type, an operation on which
the error occured and a message.
In addition, all exceptions share an error handler which is set on this
class. The handleError
method hands off the exception to
this handler which decides on a course of action. By default, the error
handler is an instance of DefaultErrorHandler
.
- Author:
- Trevor Misfeldt
- See Also:
- PrecisionExceededException, InvalidExchangeException, MismatchedCurrenciesException, ErrorHandler, DefaultErrorHandler
-
ADDITION
- Identifies an error that happens during an addition.
-
COMPARISON
- Identifies an error that happens during a comparison.
-
DIVISION
- Identifies an error that happens during a division.
-
EXCHANGE
- Identifies an error that happens during an exchange operation.
-
INVALID_EXCHANGE
- Exchange could not be completed.
-
MISMATCHED_CURRENCIES
- Currencies were not equal where required.
-
MULTIPLICATION
- Identifies an error that happens during a multiplication.
-
NUMBER_OF_OPERATIONS
- The total number of operation types.
-
PRECISION_EXCEEDED
- Error caused by imprecision.
-
SUBTRACTION
- Identifies an error that happens during a subtraction.
-
MoneyException(short)
- Creates a money exception with the specified operation.
-
MoneyException(short, String)
- Creates a money exception with the specified operation and message.
-
getErrorHandler()
- Returns the error handler used by all classes and methods.
-
getOperation()
- Returns the operation that was being performed when the error occured.
-
getOperationAsString()
- Returns a string representation of the string for output.
-
handleError(MoneyException)
- Hands off the exception to the current error handler.
-
setErrorHandler(ErrorHandler)
- Sets the error handler to a new instance.
-
toString()
- A string representation of the exception.
EXCHANGE
public static final short EXCHANGE
- Identifies an error that happens during an exchange operation.
ADDITION
public static final short ADDITION
- Identifies an error that happens during an addition.
MULTIPLICATION
public static final short MULTIPLICATION
- Identifies an error that happens during a multiplication.
DIVISION
public static final short DIVISION
- Identifies an error that happens during a division.
SUBTRACTION
public static final short SUBTRACTION
- Identifies an error that happens during a subtraction.
COMPARISON
public static final short COMPARISON
- Identifies an error that happens during a comparison.
NUMBER_OF_OPERATIONS
public static final short NUMBER_OF_OPERATIONS
- The total number of operation types.
PRECISION_EXCEEDED
public static final short PRECISION_EXCEEDED
- Error caused by imprecision.
INVALID_EXCHANGE
public static final short INVALID_EXCHANGE
- Exchange could not be completed.
MISMATCHED_CURRENCIES
public static final short MISMATCHED_CURRENCIES
- Currencies were not equal where required.
MoneyException
protected MoneyException(short operation)
- Creates a money exception with the specified operation.
- Parameters:
- operation - desribes the operation
- See Also:
- EXCHANGE, ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, COMPARISON
MoneyException
protected MoneyException(short operation,
String message)
- Creates a money exception with the specified operation and message.
- Parameters:
- operation - desribes the operation
- message - a String with a message describing the error
- See Also:
- EXCHANGE, ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, COMPARISON
getErrorHandler
public static ErrorHandler getErrorHandler()
- Returns the error handler used by all classes and methods.
- Returns:
- the current error handler
- See Also:
- ErrorHandler, DefaultErrorHandler
setErrorHandler
public static void setErrorHandler(ErrorHandler handler)
- Sets the error handler to a new instance. One can change the current
error handling setup by retrieving the error handler, modifying it and
then reseting it.
- Parameters:
- handler - the new error handler
- See Also:
- ErrorHandler, DefaultErrorHandler
handleError
public static void handleError(MoneyException exception)
- Hands off the exception to the current error handler.
- Parameters:
- exception - an error withing the Money code
- See Also:
- ErrorHandler, DefaultErrorHandler
getOperation
public short getOperation()
- Returns the operation that was being performed when the error occured.
- Returns:
- the operation
- See Also:
- EXCHANGE, ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, COMPARISON
getOperationAsString
protected String getOperationAsString()
- Returns a string representation of the string for output.
- Returns:
- a string
toString
public abstract String toString()
- A string representation of the exception.
- Returns:
- the string
- Overrides:
- toString in class Throwable
All Packages Class Hierarchy This Package Previous Next Index