Dashboard > GreenPepper Demo > ... > Bank > AccountType.java
  GreenPepper Demo Log In View a printable version of the current page.  
  AccountType.java
Added by admin, last edited by admin on Jan 07, 2009
Labels: 
(None)

AccountType.java
package com.greenpepper.confluence.demo.bank;

import java.util.EnumMap;

public enum AccountType
{

  SAVINGS("savings", Money.$(200f), Money.$(200f), null, Money.$(1.5f), Money.$(2.5f), Money.$(0.5f)),
  CHECKING("checking", Money.$(200f), Money.$(200f), null, Money.$(0), Money.$(2.50f), Money.$(0));

  private final String description;

  private EnumMap<WithdrawType, Money> limits;
  private EnumMap<WithdrawType, Money> fees;

  private AccountType(String description, Money limitBankMachine,
            Money limitInteracMachine, Money limitPersonalCheck,
            Money feesBankMachine, Money feesInteracMachine, Money feesPersonalCheck)
  {
    this.description = description;
    limits = new EnumMap<WithdrawType, Money>(WithdrawType.class);

    limits.put(WithdrawType.ATM, limitBankMachine);
    limits.put(WithdrawType.INTERAC, limitInteracMachine);
    limits.put(WithdrawType.PERSONAL_CHECK, limitPersonalCheck);

    fees = new EnumMap<WithdrawType, Money>(WithdrawType.class);
    fees.put(WithdrawType.ATM, feesBankMachine);
    fees.put(WithdrawType.INTERAC, feesInteracMachine);
    fees.put(WithdrawType.PERSONAL_CHECK, feesPersonalCheck);
  }

  @Override
  public String toString()
  {
    return description;
  }

  public Money limitFor(WithdrawType withdrawType)
  {
    return limits.get(withdrawType);
  }

  public Money feesFor(WithdrawType withdrawType)
  {
    return fees.get(withdrawType);
  }

  public static boolean isNoLimit(Money limit)
  {
    return limit == null;
  }
}

DEMONSTRATION LICENSE - This Confluence site is for demonstration purposes only. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators