SalesPoint v3.3 API

data
Class NotEnoughMoneyException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by data.NotEnoughMoneyException
All Implemented Interfaces:
Serializable

public class NotEnoughMoneyException
extends RuntimeException

Exception thrown when an error occurs on transferring money from one MoneyBag to another.

Since:
v3.1
Author:
Andreas Bartho
See Also:
Serialized Form

Field Summary
static int NO_FITTING_UNITS
          Indicates that this Exception was thrown because it is not possible to sum up the available money to the amount to be removed.
static int NOT_ENOUGH_MONEY
          Indicates that this Exception was thrown because the money in the MoneyBag is less than the money to be removed.
 
Constructor Summary
NotEnoughMoneyException(int cause)
          Creates a new NotEnoughMoneyException.
NotEnoughMoneyException(String sDetail, int cause)
          Creates a new NotEnoughMoneyException with a detail message.
 
Method Summary
 int cause()
          Returns the cause for this exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_ENOUGH_MONEY

public static final int NOT_ENOUGH_MONEY
Indicates that this Exception was thrown because the money in the MoneyBag is less than the money to be removed.

See Also:
Constant Field Values

NO_FITTING_UNITS

public static final int NO_FITTING_UNITS
Indicates that this Exception was thrown because it is not possible to sum up the available money to the amount to be removed.

Example:
The MoneyBag contains: Trying to return 11 cents would cause that exception.

See Also:
Constant Field Values
Constructor Detail

NotEnoughMoneyException

public NotEnoughMoneyException(int cause)
Creates a new NotEnoughMoneyException.


NotEnoughMoneyException

public NotEnoughMoneyException(String sDetail,
                               int cause)
Creates a new NotEnoughMoneyException with a detail message.

Parameters:
sDetail - the detail message.
Method Detail

cause

public int cause()
Returns the cause for this exception. If there was not enough money, NOT_ENOUGH_MONEY is returned. If there was no way to sum up the money with the coins/bank notes available, NO_FITTING_UNITS is returned.

Returns:
the cause for this exception

SalesPoint v3.3 API