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 NameReferenceType.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:22 $
28 */
29 public class NameReferenceType extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * Unambiguous reference to the resource conforming to the IVOA
40 * standard for identifiers
41 *
42 */
43 private org.astrogrid.registry.beans.resource.IdentifierType _identifier;
44
45 /***
46 * the name of someone or something
47 */
48 private java.lang.String _name;
49
50
51
52
53
54
55 public NameReferenceType() {
56 super();
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 NameReferenceType) {
78
79 NameReferenceType temp = (NameReferenceType)obj;
80 if (this._identifier != null) {
81 if (temp._identifier == null) return false;
82 else if (!(this._identifier.equals(temp._identifier)))
83 return false;
84 }
85 else if (temp._identifier != null)
86 return false;
87 if (this._name != null) {
88 if (temp._name == null) return false;
89 else if (!(this._name.equals(temp._name)))
90 return false;
91 }
92 else if (temp._name != null)
93 return false;
94 return true;
95 }
96 return false;
97 }
98
99 /***
100 * Returns the value of field 'identifier'. The field
101 * 'identifier' has the following description: Unambiguous
102 * reference to the resource conforming to the IVOA
103 * standard for identifiers
104 *
105 *
106 * @return the value of field 'identifier'.
107 */
108 public org.astrogrid.registry.beans.resource.IdentifierType getIdentifier()
109 {
110 return this._identifier;
111 }
112
113 /***
114 * Returns the value of field 'name'. The field 'name' has the
115 * following description: the name of someone or something
116 *
117 * @return the value of field 'name'.
118 */
119 public java.lang.String getName()
120 {
121 return this._name;
122 }
123
124 /***
125 * Method isValid
126 */
127 public boolean isValid()
128 {
129 try {
130 validate();
131 }
132 catch (org.exolab.castor.xml.ValidationException vex) {
133 return false;
134 }
135 return true;
136 }
137
138 /***
139 * Method marshal
140 *
141 * @param out
142 */
143 public void marshal(java.io.Writer out)
144 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
145 {
146
147 Marshaller.marshal(this, out);
148 }
149
150 /***
151 * Method marshal
152 *
153 * @param handler
154 */
155 public void marshal(org.xml.sax.ContentHandler handler)
156 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
157 {
158
159 Marshaller.marshal(this, handler);
160 }
161
162 /***
163 * Sets the value of field 'identifier'. The field 'identifier'
164 * has the following description: Unambiguous reference to the
165 * resource conforming to the IVOA
166 * standard for identifiers
167 *
168 *
169 * @param identifier the value of field 'identifier'.
170 */
171 public void setIdentifier(org.astrogrid.registry.beans.resource.IdentifierType identifier)
172 {
173 this._identifier = identifier;
174 }
175
176 /***
177 * Sets the value of field 'name'. The field 'name' has the
178 * following description: the name of someone or something
179 *
180 * @param name the value of field 'name'.
181 */
182 public void setName(java.lang.String name)
183 {
184 this._name = name;
185 }
186
187 /***
188 * Method unmarshalNameReferenceType
189 *
190 * @param reader
191 */
192 public static org.astrogrid.registry.beans.resource.NameReferenceType unmarshalNameReferenceType(java.io.Reader reader)
193 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
194 {
195 return (org.astrogrid.registry.beans.resource.NameReferenceType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.NameReferenceType.class, reader);
196 }
197
198 /***
199 * Method validate
200 */
201 public void validate()
202 throws org.exolab.castor.xml.ValidationException
203 {
204 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
205 validator.validate(this);
206 }
207
208 }