1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.resource;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * Class Date.
26 *
27 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
28 */
29 public class Date extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * internal content storage
40 */
41 private org.exolab.castor.types.Date _content;
42
43 /***
44 * A string indicating what the date refers to.
45 *
46 */
47 private java.lang.String _role = "representative";
48
49
50
51
52
53
54 public Date() {
55 super();
56 setRole("representative");
57 }
58
59
60
61
62
63
64 /***
65 * Note: hashCode() has not been overriden
66 *
67 * @param obj
68 */
69 public boolean equals(java.lang.Object obj)
70 {
71 if ( this == obj )
72 return true;
73
74 if (super.equals(obj)==false)
75 return false;
76
77 if (obj instanceof Date) {
78
79 Date temp = (Date)obj;
80 if (this._content != null) {
81 if (temp._content == null) return false;
82 else if (!(this._content.equals(temp._content)))
83 return false;
84 }
85 else if (temp._content != null)
86 return false;
87 if (this._role != null) {
88 if (temp._role == null) return false;
89 else if (!(this._role.equals(temp._role)))
90 return false;
91 }
92 else if (temp._role != null)
93 return false;
94 return true;
95 }
96 return false;
97 }
98
99 /***
100 * Returns the value of field 'content'. The field 'content'
101 * has the following description: internal content storage
102 *
103 * @return the value of field 'content'.
104 */
105 public org.exolab.castor.types.Date getContent()
106 {
107 return this._content;
108 }
109
110 /***
111 * Returns the value of field 'role'. The field 'role' has the
112 * following description: A string indicating what the date
113 * refers to.
114 *
115 *
116 * @return the value of field 'role'.
117 */
118 public java.lang.String getRole()
119 {
120 return this._role;
121 }
122
123 /***
124 * Method isValid
125 */
126 public boolean isValid()
127 {
128 try {
129 validate();
130 }
131 catch (org.exolab.castor.xml.ValidationException vex) {
132 return false;
133 }
134 return true;
135 }
136
137 /***
138 * Method marshal
139 *
140 * @param out
141 */
142 public void marshal(java.io.Writer out)
143 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
144 {
145
146 Marshaller.marshal(this, out);
147 }
148
149 /***
150 * Method marshal
151 *
152 * @param handler
153 */
154 public void marshal(org.xml.sax.ContentHandler handler)
155 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
156 {
157
158 Marshaller.marshal(this, handler);
159 }
160
161 /***
162 * Sets the value of field 'content'. The field 'content' has
163 * the following description: internal content storage
164 *
165 * @param content the value of field 'content'.
166 */
167 public void setContent(org.exolab.castor.types.Date content)
168 {
169 this._content = content;
170 }
171
172 /***
173 * Sets the value of field 'role'. The field 'role' has the
174 * following description: A string indicating what the date
175 * refers to.
176 *
177 *
178 * @param role the value of field 'role'.
179 */
180 public void setRole(java.lang.String role)
181 {
182 this._role = role;
183 }
184
185 /***
186 * Method unmarshalDate
187 *
188 * @param reader
189 */
190 public static org.astrogrid.registry.beans.v10.resource.Date unmarshalDate(java.io.Reader reader)
191 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
192 {
193 return (org.astrogrid.registry.beans.v10.resource.Date) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Date.class, reader);
194 }
195
196 /***
197 * Method validate
198 */
199 public void validate()
200 throws org.exolab.castor.xml.ValidationException
201 {
202 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
203 validator.validate(this);
204 }
205
206 }