1 27 28 29 package com.sun.ebank.util; 30 31 import java.util.*; 32 import com.sun.ebank.ejb.exception.*; 33 34 35 39 public final class DomainUtil { 40 private static String [] accountTypes = 42 { "Checking", "Savings", "Credit", "Money Market" }; 43 44 public static String [] getAccountTypes() { 45 return accountTypes; 46 } 47 48 public static void checkAccountType(String type) 49 throws IllegalAccountTypeException { 50 boolean foundIt = false; 51 52 for (int i = 0; i < accountTypes.length; i++) { 53 if (accountTypes[i].equals(type)) { 54 foundIt = true; 55 } 56 } 57 58 if (foundIt == false) { 59 throw new IllegalAccountTypeException(type); 60 } 61 } 62 63 public static boolean isCreditAccount(String type) { 64 if (type.equals("Credit")) { 65 return true; 66 } else { 67 return false; 68 } 69 } 70 } 71 | Popular Tags |