KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: FooComponent.java,v 1.1 2004/09/26 05:18:25 oneovthafew Exp $
2
package org.hibernate.test.legacy;
3
4 import java.io.Serializable JavaDoc;
5 import java.util.Date JavaDoc;
6
7 public class FooComponent implements Serializable JavaDoc {
8     
9     int count;
10     String JavaDoc name;
11     Date JavaDoc[] importantDates;
12     FooComponent subcomponent;
13     Fee fee = new Fee();
14     GlarchProxy glarch;
15     private FooProxy parent;
16     private Baz baz;
17     
18     public boolean equals(Object JavaDoc that) {
19         FooComponent fc = (FooComponent) that;
20         return count==fc.count;
21     }
22     
23     public int hashCode() {
24         return count;
25     }
26     
27     public String JavaDoc toString() {
28         String JavaDoc result = "FooComponent: " + name + "=" + count;
29         result+="; dates=[";
30         if ( importantDates!=null) {
31             for ( int i=0; i<importantDates.length; i++ ) {
32                 result+=(i==0 ?"":", ") + importantDates[i];
33             }
34         }
35         result+="]";
36         if ( subcomponent!=null ) {
37             result+= " (" + subcomponent + ")";
38         }
39         return result;
40     }
41     
42     public FooComponent() {}
43     
44     FooComponent(String JavaDoc name, int count, Date JavaDoc[] dates, FooComponent subcomponent) {
45         this.name = name;
46         this.count = count;
47         this.importantDates = dates;
48         this.subcomponent = subcomponent;
49     }
50     
51     FooComponent(String JavaDoc name, int count, Date JavaDoc[] dates, FooComponent subcomponent, Fee fee) {
52         this.name = name;
53         this.count = count;
54         this.importantDates = dates;
55         this.subcomponent = subcomponent;
56         this.fee = fee;
57     }
58     
59     public int getCount() {
60         return count;
61     }
62     public void setCount(int count) {
63         this.count = count;
64     }
65     
66     public String JavaDoc getName() {
67         return name;
68     }
69     public void setName(String JavaDoc name) {
70         this.name = name;
71     }
72     
73     public Date JavaDoc[] getImportantDates() {
74         return importantDates;
75     }
76     public void setImportantDates(Date JavaDoc[] importantDates) {
77         this.importantDates = importantDates;
78     }
79     
80     public FooComponent getSubcomponent() {
81         return subcomponent;
82     }
83     public void setSubcomponent(FooComponent subcomponent) {
84         this.subcomponent = subcomponent;
85     }
86     
87     private String JavaDoc getNull() {
88         return null;
89     }
90     private void setNull(String JavaDoc str) throws Exception JavaDoc {
91         if (str!=null) throw new Exception JavaDoc("null component property");
92     }
93     public Fee getFee() {
94         return fee;
95     }
96     
97     public void setFee(Fee fee) {
98         this.fee = fee;
99     }
100     
101     public GlarchProxy getGlarch() {
102         return glarch;
103     }
104     
105     public void setGlarch(GlarchProxy glarch) {
106         this.glarch = glarch;
107     }
108     
109     public FooProxy getParent() {
110         return parent;
111     }
112     
113     public void setParent(FooProxy parent) {
114         //if (parent==null) throw new RuntimeException("null parent set");
115
this.parent = parent;
116     }
117     
118     public Baz getBaz() {
119         return baz;
120     }
121     
122     public void setBaz(Baz baz) {
123         this.baz = baz;
124     }
125     
126 }
127
128
129
130
131
132
133
134
Popular Tags