com.ail.financial
Class MoneyProvision

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.financial.MoneyProvision
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MoneyProvision
extends Type

MoneyProvision objects represents an amount of money that is payable or due from one party to another party. It may be a single payment, or a number of payments of an identical amount at a frequency.

For example it may represent:-

  1. a single payment of £30 by direct debit from account number xxxxxxx, sort code yyyyyy; or
  2. 10 payments of £30 each paid monthly by Master Card with card number xxxxx, card holder yyy.

Version:
$Revision: 1.5 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
MoneyProvision()
          Default constructor
MoneyProvision(int number, CurrencyAmount amount, FinancialFrequency frequency, PaymentMethod paymentMethod, java.util.Date paymentsStartDate, java.util.Date paymentsEndDate, java.lang.String description)
           
 
Method Summary
 CurrencyAmount calculateTotal()
          Calculate the total value of this provision assuming that all payments were made.
 CurrencyAmount getAmount()
          Getter returning the value of the amount property.
 java.lang.String getDescription()
          Getter returning the value of the description property.
 FinancialFrequency getFrequency()
          Getter returning the value of the frequency property.
 java.lang.String getFrequencyAsString()
          Get the value of the frequency property as a string (as opposed to an instance of FinancialFrequency).
 int getNumber()
           
 PaymentMethod getPaymentMethod()
           
 java.util.Date getPaymentsEndDate()
          Getter returning the value of the paymentsEndDate property.
 java.util.Date getPaymentsStartDate()
          Getter returning the value of the paymentsStartDate property.
 void setAmount(CurrencyAmount amount)
          Setter to update the value of the amount property.
 void setDescription(java.lang.String description)
          Setter to update the value of the description property.
 void setFrequency(FinancialFrequency frequency)
          Setter to update the value of the frequency property.
 void setFrequencyAsString(java.lang.String frequency)
          Set the frequency property as a String.
 void setNumber(int number)
           
 void setPaymentMethod(PaymentMethod paymentMethod)
           
 void setPaymentsEndDate(java.util.Date paymentsEndDate)
          Setter to update the value of the paymentsEndDate property.
 void setPaymentsStartDate(java.util.Date paymentsStartDate)
          Setter to update the value of the paymentsStartDate property.
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoneyProvision

public MoneyProvision()
Default constructor


MoneyProvision

public MoneyProvision(int number,
                      CurrencyAmount amount,
                      FinancialFrequency frequency,
                      PaymentMethod paymentMethod,
                      java.util.Date paymentsStartDate,
                      java.util.Date paymentsEndDate,
                      java.lang.String description)
Parameters:
number - The number of payments to be made.
amount - The amount of each payment (all are equal).
frequency - The frequency of payments (Monthly, Weekly, etc).
paymentMethod - The method e.g. payment card, direct debit, etc.
paymentsStartDate - The date when payments start.
paymentsEndDate - The date when payments end.
description - Any textual description.
Method Detail

getAmount

public CurrencyAmount getAmount()
Getter returning the value of the amount property. The amount of money.

Returns:
Value of the amount property

setAmount

public void setAmount(CurrencyAmount amount)
Setter to update the value of the amount property. The amount of money.

Parameters:
amount - New value for the amount property

getPaymentsStartDate

public java.util.Date getPaymentsStartDate()
Getter returning the value of the paymentsStartDate property. The date at which payments start.

Returns:
Value of the paymentsStartDate property

setPaymentsStartDate

public void setPaymentsStartDate(java.util.Date paymentsStartDate)
Setter to update the value of the paymentsStartDate property. The date at which payments start.

Parameters:
paymentsStartDate - New value for the paymentsStartDate property

getPaymentsEndDate

public java.util.Date getPaymentsEndDate()
Getter returning the value of the paymentsEndDate property. The date at which payments end

Returns:
Value of the paymentsEndDate property

setPaymentsEndDate

public void setPaymentsEndDate(java.util.Date paymentsEndDate)
Setter to update the value of the paymentsEndDate property. The date at which payments end

Parameters:
paymentsEndDate - New value for the paymentsEndDate property

getDescription

public java.lang.String getDescription()
Getter returning the value of the description property. A textual description of the reason for the payment.

Returns:
Value of the description property

setDescription

public void setDescription(java.lang.String description)
Setter to update the value of the description property. A textual description of the reason for the payment.

Parameters:
description - New value for the description property

getFrequency

public FinancialFrequency getFrequency()
Getter returning the value of the frequency property. Payment frequency

Returns:
Value of the frequency property

setFrequency

public void setFrequency(FinancialFrequency frequency)
Setter to update the value of the frequency property. Payment frequency

Parameters:
frequency - New value for the frequency property

getFrequencyAsString

public java.lang.String getFrequencyAsString()
Get the value of the frequency property as a string (as opposed to an instance of FinancialFrequency).

Returns:
String representation of the frequency, or null if the property has not been set.

setFrequencyAsString

public void setFrequencyAsString(java.lang.String frequency)
                          throws java.lang.IndexOutOfBoundsException
Set the frequency property as a String. The String must represents a valid FinancialFrequency. i.e. it must be suitable for a call to FinancialFrequency.forName().

Parameters:
frequency - New value for property.
Throws:
java.lang.IndexOutOfBoundsException - If frequency is not a valid FinancialFrequency.

getPaymentMethod

public PaymentMethod getPaymentMethod()

setPaymentMethod

public void setPaymentMethod(PaymentMethod paymentMethod)

getNumber

public int getNumber()

setNumber

public void setNumber(int number)

calculateTotal

public CurrencyAmount calculateTotal()
Calculate the total value of this provision assuming that all payments were made.

Returns:
amount * number