KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > Zoo


1 package org.apache.ojb.broker;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.List JavaDoc;
5 import java.util.Vector JavaDoc;
6
7 import org.apache.commons.lang.builder.ToStringBuilder;
8
9 /**
10  * @author <a HREF="mailto:schneider@mendel.imp.univie.ac.at">Georg Schneider</a>
11  *
12  */

13 public class Zoo implements Serializable JavaDoc
14 {
15     private int zooId;
16     private String JavaDoc name;
17     private List JavaDoc animals = new Vector JavaDoc();
18
19     /**
20      * Constructor for Zoo.
21      */

22     public Zoo()
23     {
24         super();
25     }
26     
27     public Zoo(String JavaDoc name)
28     {
29         this.name = name;
30     }
31     
32     public List JavaDoc getAnimals()
33     {
34         return animals;
35     }
36
37     public void addAnimal(InterfaceAnimal animal)
38     {
39         animals.add(animal);
40     }
41     
42     public int getZooId()
43     {
44         return zooId;
45     }
46     
47     public String JavaDoc toString()
48     {
49         return new ToStringBuilder(this)
50                 .append("id", zooId)
51                 .append("name", name)
52                 .append("animals", animals)
53                 .toString();
54     }
55
56     /**
57      * Returns the name.
58      * @return String
59      */

60     public String JavaDoc getName()
61     {
62         return name;
63     }
64
65     /**
66      * Sets the animals.
67      * @param animals The animals to set
68      */

69     public void setAnimals(List JavaDoc animals)
70     {
71         this.animals = animals;
72     }
73
74     /**
75      * Sets the name.
76      * @param name The name to set
77      */

78     public void setName(String JavaDoc name)
79     {
80         this.name = name;
81     }
82
83     /**
84      * Sets the zooId.
85      * @param zooId The zooId to set
86      */

87     public void setZooId(int zooId)
88     {
89         this.zooId = zooId;
90     }
91
92 }
93
Popular Tags