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

Variable Index

 o ADDITION
Identifies an error that happens during an addition.
 o COMPARISON
Identifies an error that happens during a comparison.
 o DIVISION
Identifies an error that happens during a division.
 o EXCHANGE
Identifies an error that happens during an exchange operation.
 o INVALID_EXCHANGE
Exchange could not be completed.
 o MISMATCHED_CURRENCIES
Currencies were not equal where required.
 o MULTIPLICATION
Identifies an error that happens during a multiplication.
 o NUMBER_OF_OPERATIONS
The total number of operation types.
 o PRECISION_EXCEEDED
Error caused by imprecision.
 o SUBTRACTION
Identifies an error that happens during a subtraction.

Constructor Index

 o MoneyException(short)
Creates a money exception with the specified operation.
 o MoneyException(short, String)
Creates a money exception with the specified operation and message.

Method Index

 o getErrorHandler()
Returns the error handler used by all classes and methods.
 o getOperation()
Returns the operation that was being performed when the error occured.
 o getOperationAsString()
Returns a string representation of the string for output.
 o handleError(MoneyException)
Hands off the exception to the current error handler.
 o setErrorHandler(ErrorHandler)
Sets the error handler to a new instance.
 o toString()
A string representation of the exception.

Variables

 o EXCHANGE
 public static final short EXCHANGE
Identifies an error that happens during an exchange operation.

 o ADDITION
 public static final short ADDITION
Identifies an error that happens during an addition.

 o MULTIPLICATION
 public static final short MULTIPLICATION
Identifies an error that happens during a multiplication.

 o DIVISION
 public static final short DIVISION
Identifies an error that happens during a division.

 o SUBTRACTION
 public static final short SUBTRACTION
Identifies an error that happens during a subtraction.

 o COMPARISON
 public static final short COMPARISON
Identifies an error that happens during a comparison.

 o NUMBER_OF_OPERATIONS
 public static final short NUMBER_OF_OPERATIONS
The total number of operation types.

 o PRECISION_EXCEEDED
 public static final short PRECISION_EXCEEDED
Error caused by imprecision.

 o INVALID_EXCHANGE
 public static final short INVALID_EXCHANGE
Exchange could not be completed.

 o MISMATCHED_CURRENCIES
 public static final short MISMATCHED_CURRENCIES
Currencies were not equal where required.

Constructors

 o 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
 o 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

Methods

 o getErrorHandler
 public static ErrorHandler getErrorHandler()
Returns the error handler used by all classes and methods.

Returns:
the current error handler
See Also:
ErrorHandler, DefaultErrorHandler
 o 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
 o 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
 o 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
 o getOperationAsString
 protected String getOperationAsString()
Returns a string representation of the string for output.

Returns:
a string
 o 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