KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > legacy > Container


1 //$Id: Container.java,v 1.2 2005/05/21 14:22:15 oneovthafew Exp $
2
package org.hibernate.test.legacy;
3
4 import java.util.ArrayList JavaDoc;
5 import java.util.Collection JavaDoc;
6 import java.util.List JavaDoc;
7 import java.util.Map JavaDoc;
8 import java.util.Set JavaDoc;
9
10 public class Container {
11     
12     public static final class ContainerInnerClass {
13         private Simple simple;
14         private String JavaDoc name;
15         private One one;
16         private Many many;
17         private int count;
18         
19         public void setSimple(Simple simple) {
20             this.simple = simple;
21         }
22         
23         public Simple getSimple() {
24             return simple;
25         }
26         /**
27          * Returns the name.
28          * @return String
29          */

30         public String JavaDoc getName() {
31             return name;
32         }
33         
34         /**
35          * Sets the name.
36          * @param name The name to set
37          */

38         public void setName(String JavaDoc name) {
39             this.name = name;
40         }
41         
42         public String JavaDoc toString() {
43             return name + " = "
44             + (simple==null ? "nil" : Integer.toString( simple.getCount() ) )
45             + "/" + ( one==null ? "nil" : one.getKey().toString() )
46             + "/" + ( many==null ? "nil" : many.getKey().toString() );
47         }
48         
49         
50         /**
51          * Returns the one.
52          * @return One
53          */

54         public One getOne() {
55             return one;
56         }
57         
58         /**
59          * Sets the one.
60          * @param one The one to set
61          */

62         public void setOne(One one) {
63             this.one = one;
64         }
65         
66         /**
67          * Returns the many.
68          * @return Many
69          */

70         public Many getMany() {
71             return many;
72         }
73         
74         /**
75          * Sets the many.
76          * @param many The many to set
77          */

78         public void setMany(Many many) {
79             this.many = many;
80         }
81         
82         /**
83          * Returns the count.
84          * @return int
85          */

86         public int getCount() {
87             return count;
88         }
89
90         /**
91          * Sets the count.
92          * @param count The count to set
93          */

94         public void setCount(int count) {
95             this.count = count;
96         }
97         
98         public int hashCode() {
99             return count + name.hashCode();
100         }
101         
102         public boolean equals(Object JavaDoc other) {
103             ContainerInnerClass cic = (ContainerInnerClass) other;
104             return cic.name.equals(name)
105                 && cic.count==count
106                 && cic.one.getKey().equals(one.getKey())
107                 && cic.many.getKey().equals(many.getKey())
108                 && cic.simple.getCount()==simple.getCount();
109         }
110
111     }
112     
113     private List JavaDoc oneToMany;
114     private List JavaDoc manyToMany;
115     private List JavaDoc components;
116     private Set JavaDoc composites;
117     private Collection JavaDoc cascades;
118     private long id;
119     private Collection JavaDoc bag;
120     private Collection JavaDoc lazyBag = new ArrayList JavaDoc();
121     private Map JavaDoc ternaryMap;
122     private Set JavaDoc ternarySet;
123     
124     /**
125      * Constructor for Container.
126      */

127     public Container() {
128         super();
129     }
130     
131     /**
132      * Returns the components.
133      * @return List
134      */

135     public List JavaDoc getComponents() {
136         return components;
137     }
138     
139     /**
140      * Returns the manyToMany.
141      * @return List
142      */

143     public List JavaDoc getManyToMany() {
144         return manyToMany;
145     }
146     
147     /**
148      * Returns the oneToMany.
149      * @return List
150      */

151     public List JavaDoc getOneToMany() {
152         return oneToMany;
153     }
154     
155     /**
156      * Sets the components.
157      * @param components The components to set
158      */

159     public void setComponents(List JavaDoc components) {
160         this.components = components;
161     }
162     
163     /**
164      * Sets the manyToMany.
165      * @param manyToMany The manyToMany to set
166      */

167     public void setManyToMany(List JavaDoc manyToMany) {
168         this.manyToMany = manyToMany;
169     }
170     
171     /**
172      * Sets the oneToMany.
173      * @param oneToMany The oneToMany to set
174      */

175     public void setOneToMany(List JavaDoc oneToMany) {
176         this.oneToMany = oneToMany;
177     }
178     
179     /**
180      * Returns the id.
181      * @return long
182      */

183     public long getId() {
184         return id;
185     }
186     
187     /**
188      * Sets the id.
189      * @param id The id to set
190      */

191     public void setId(long id) {
192         this.id = id;
193     }
194     
195     /**
196      * Gets the composites.
197      * @return Returns a Set
198      */

199     public Set JavaDoc getComposites() {
200         return composites;
201     }
202     
203     /**
204      * Sets the composites.
205      * @param composites The composites to set
206      */

207     public void setComposites(Set JavaDoc composites) {
208         this.composites = composites;
209     }
210     
211     /**
212      * Returns the bag.
213      * @return Collection
214      */

215     public Collection JavaDoc getBag() {
216         return bag;
217     }
218     
219     /**
220      * Sets the bag.
221      * @param bag The bag to set
222      */

223     public void setBag(Collection JavaDoc bag) {
224         this.bag = bag;
225     }
226     
227     /**
228      * Returns the ternary.
229      * @return Map
230      */

231     public Map JavaDoc getTernaryMap() {
232         return ternaryMap;
233     }
234     
235     /**
236      * Sets the ternary.
237      * @param ternary The ternary to set
238      */

239     public void setTernaryMap(Map JavaDoc ternary) {
240         this.ternaryMap = ternary;
241     }
242     
243     public static final class Ternary {
244         private String JavaDoc name;
245         private Foo foo;
246         private Glarch glarch;
247         /**
248          * Returns the foo.
249          * @return Foo
250          */

251         public Foo getFoo() {
252             return foo;
253         }
254         
255         /**
256          * Returns the glarch.
257          * @return Glarch
258          */

259         public Glarch getGlarch() {
260             return glarch;
261         }
262         
263         /**
264          * Returns the name.
265          * @return String
266          */

267         public String JavaDoc getName() {
268             return name;
269         }
270         
271         /**
272          * Sets the foo.
273          * @param foo The foo to set
274          */

275         public void setFoo(Foo foo) {
276             this.foo = foo;
277         }
278         
279         /**
280          * Sets the glarch.
281          * @param glarch The glarch to set
282          */

283         public void setGlarch(Glarch glarch) {
284             this.glarch = glarch;
285         }
286         
287         /**
288          * Sets the name.
289          * @param name The name to set
290          */

291         public void setName(String JavaDoc name) {
292             this.name = name;
293         }
294         
295     }
296     
297     /**
298      * Returns the ternarySet.
299      * @return Set
300      */

301     public Set JavaDoc getTernarySet() {
302         return ternarySet;
303     }
304     
305     /**
306      * Sets the ternarySet.
307      * @param ternarySet The ternarySet to set
308      */

309     public void setTernarySet(Set JavaDoc ternarySet) {
310         this.ternarySet = ternarySet;
311     }
312     
313     /**
314      * Returns the lazyBag.
315      * @return Collection
316      */

317     public Collection JavaDoc getLazyBag() {
318         return lazyBag;
319     }
320     
321     /**
322      * Sets the lazyBag.
323      * @param lazyBag The lazyBag to set
324      */

325     public void setLazyBag(Collection JavaDoc lazyBag) {
326         this.lazyBag = lazyBag;
327     }
328     
329     /**
330      * Returns the cascades.
331      * @return Collection
332      */

333     public Collection JavaDoc getCascades() {
334         return cascades;
335     }
336
337     /**
338      * Sets the cascades.
339      * @param cascades The cascades to set
340      */

341     public void setCascades(Collection JavaDoc cascades) {
342         this.cascades = cascades;
343     }
344
345 }
346
347
348
349
350
351
352
Popular Tags