it.dtt.ca.util
Class Wallet

java.lang.Object
  extended by it.dtt.ca.util.Wallet

public class Wallet
extends java.lang.Object

This class represents a digital wallet. The content of this class is informative only: applications using this class cannot change any value contained in the wallet.

Wallets will depend upon the current user.

The current user is defined and retrieved using the org.dvb.user.GeneralPreference("UserName", String userName).

The user name is stored by:

  • GeneralPreference myPref = new GeneralPreference("UserName", "John Doe");
  • UserPreferenceManager.getInstance().write(myPref);

    And can be read by:

  • GeneralPreference myPref = new GeneralPreference("UserName").
  • UserPreferenceManager.getInstance().read(myPref);
  • String myUserName = myPref.getMostFavourite();


    Constructor Summary
    protected Wallet(java.lang.String name, java.lang.String id, java.util.Date expiryDate, Money credit, int boughtCount, int boughtLeftCount)
              Creates a wallet.
     
    Method Summary
     int getBoughtNumber()
              Gets the number of events bought with this card.
     int getCanBuyNumber()
              Return the number of events that can be bought.
     Money getCredit()
              Gets the credit left in the Wallet.
     java.util.Date getExpiryDate()
              Get the expiry date of this Wallet.
     java.lang.String getId()
              Get the identifier of this Wallet.
     java.lang.String getName()
              Get the name of this Wallet.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Wallet

    protected Wallet(java.lang.String name,
                     java.lang.String id,
                     java.util.Date expiryDate,
                     Money credit,
                     int boughtCount,
                     int boughtLeftCount)
    Creates a wallet.

    Parameters:
    name - name.
    id - id.
    expiryDate - expiry date.
    credit - the credit to store on the wallet.
    boughtCount - bought count.
    boughtLeftCount - bought left count.
    Method Detail

    getName

    public java.lang.String getName()
    Get the name of this Wallet.

    Returns:
    the name of this wallet.

    getId

    public java.lang.String getId()
    Get the identifier of this Wallet.

    Returns:
    the identifier of this wallet.

    getExpiryDate

    public java.util.Date getExpiryDate()
    Get the expiry date of this Wallet.

    Returns:
    the expiry date.

    getCredit

    public Money getCredit()
    Gets the credit left in the Wallet.

    Returns:
    the credit left.

    getBoughtNumber

    public int getBoughtNumber()
    Gets the number of events bought with this card.

    Returns:
    number of bought events

    getCanBuyNumber

    public int getCanBuyNumber()
    Return the number of events that can be bought.

    Returns:
    number of events the user can buy