1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.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 ContactType.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:23 $
28 */
29 public class ContactType extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * the name of someone or something
40 */
41 private java.lang.String _name;
42
43 /***
44 * Unambiguous reference to the resource conforming to the IVOA
45 * standard for identifiers
46 *
47 */
48 private org.astrogrid.registry.beans.resource.IdentifierType _identifier;
49
50 /***
51 * an email address
52 */
53 private java.lang.String _email;
54
55
56
57
58
59
60 public ContactType() {
61 super();
62 }
63
64
65
66
67
68
69 /***
70 * Note: hashCode() has not been overriden
71 *
72 * @param obj
73 */
74 public boolean equals(java.lang.Object obj)
75 {
76 if ( this == obj )
77 return true;
78
79 if (super.equals(obj)==false)
80 return false;
81
82 if (obj instanceof ContactType) {
83
84 ContactType temp = (ContactType)obj;
85 if (this._name != null) {
86 if (temp._name == null) return false;
87 else if (!(this._name.equals(temp._name)))
88 return false;
89 }
90 else if (temp._name != null)
91 return false;
92 if (this._identifier != null) {
93 if (temp._identifier == null) return false;
94 else if (!(this._identifier.equals(temp._identifier)))
95 return false;
96 }
97 else if (temp._identifier != null)
98 return false;
99 if (this._email != null) {
100 if (temp._email == null) return false;
101 else if (!(this._email.equals(temp._email)))
102 return false;
103 }
104 else if (temp._email != null)
105 return false;
106 return true;
107 }
108 return false;
109 }
110
111 /***
112 * Returns the value of field 'email'. The field 'email' has
113 * the following description: an email address
114 *
115 * @return the value of field 'email'.
116 */
117 public java.lang.String getEmail()
118 {
119 return this._email;
120 }
121
122 /***
123 * Returns the value of field 'identifier'. The field
124 * 'identifier' has the following description: Unambiguous
125 * reference to the resource conforming to the IVOA
126 * standard for identifiers
127 *
128 *
129 * @return the value of field 'identifier'.
130 */
131 public org.astrogrid.registry.beans.resource.IdentifierType getIdentifier()
132 {
133 return this._identifier;
134 }
135
136 /***
137 * Returns the value of field 'name'. The field 'name' has the
138 * following description: the name of someone or something
139 *
140 * @return the value of field 'name'.
141 */
142 public java.lang.String getName()
143 {
144 return this._name;
145 }
146
147 /***
148 * Method isValid
149 */
150 public boolean isValid()
151 {
152 try {
153 validate();
154 }
155 catch (org.exolab.castor.xml.ValidationException vex) {
156 return false;
157 }
158 return true;
159 }
160
161 /***
162 * Method marshal
163 *
164 * @param out
165 */
166 public void marshal(java.io.Writer out)
167 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
168 {
169
170 Marshaller.marshal(this, out);
171 }
172
173 /***
174 * Method marshal
175 *
176 * @param handler
177 */
178 public void marshal(org.xml.sax.ContentHandler handler)
179 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
180 {
181
182 Marshaller.marshal(this, handler);
183 }
184
185 /***
186 * Sets the value of field 'email'. The field 'email' has the
187 * following description: an email address
188 *
189 * @param email the value of field 'email'.
190 */
191 public void setEmail(java.lang.String email)
192 {
193 this._email = email;
194 }
195
196 /***
197 * Sets the value of field 'identifier'. The field 'identifier'
198 * has the following description: Unambiguous reference to the
199 * resource conforming to the IVOA
200 * standard for identifiers
201 *
202 *
203 * @param identifier the value of field 'identifier'.
204 */
205 public void setIdentifier(org.astrogrid.registry.beans.resource.IdentifierType identifier)
206 {
207 this._identifier = identifier;
208 }
209
210 /***
211 * Sets the value of field 'name'. The field 'name' has the
212 * following description: the name of someone or something
213 *
214 * @param name the value of field 'name'.
215 */
216 public void setName(java.lang.String name)
217 {
218 this._name = name;
219 }
220
221 /***
222 * Method unmarshalContactType
223 *
224 * @param reader
225 */
226 public static org.astrogrid.registry.beans.resource.ContactType unmarshalContactType(java.io.Reader reader)
227 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
228 {
229 return (org.astrogrid.registry.beans.resource.ContactType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.ContactType.class, reader);
230 }
231
232 /***
233 * Method validate
234 */
235 public void validate()
236 throws org.exolab.castor.xml.ValidationException
237 {
238 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
239 validator.validate(this);
240 }
241
242 }