1 package org.apache.ojb.broker; 2 3 import java.io.Serializable ; 4 import java.util.Iterator ; 5 import java.util.List ; 6 import java.util.Vector ; 7 8 13 public class Gourmet implements Serializable 14 { 15 int gourmetId; 16 String name; 17 List favoriteFood = new Vector (); 18 21 public Gourmet() 22 { 23 super(); 24 } 25 26 public Gourmet(String name) 27 { 28 this.name = name; 29 } 30 31 public List getFavoriteFood() 32 { 33 return favoriteFood; 34 } 35 36 public void addFavoriteFood(InterfaceFood food) 37 { 38 favoriteFood.add(food); 39 } 40 41 45 public int getGourmetId() 46 { 47 return gourmetId; 48 } 49 50 public String toString() 51 { 52 StringBuffer text = new StringBuffer ("Gourmet: id = " + gourmetId + "\n"); 53 text.append("name = "); 54 text.append(name); 55 text.append("\nFavoriteFood:\n"); 56 for(Iterator it = favoriteFood.iterator(); it.hasNext();) 57 { 58 text.append(it.next().toString()); 59 text.append("\n-------\n"); 60 } 61 return text.toString(); 62 } 63 64 65 69 public String getName() 70 { 71 return name; 72 } 73 74 78 public void setFavoriteFood(List favoriteFood) 79 { 80 this.favoriteFood = favoriteFood; 81 } 82 83 87 public void setGourmetId(int gourmetId) 88 { 89 this.gourmetId = gourmetId; 90 } 91 92 96 public void setName(String name) 97 { 98 this.name = name; 99 } 100 101 } 102 | Popular Tags |