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 Source.
26 *
27 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
28 */
29 public class Source 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 java.lang.String _content = "";
42
43 /***
44 * The reference format. Recognized values include "bibcode",
45 * refering to a standard astronomical bibcode bibcode
46 * (http://cdsweb.u-strasbg.fr/simbad/refcode.html).
47 *
48 */
49 private java.lang.String _format;
50
51
52
53
54
55
56 public Source() {
57 super();
58 setContent("");
59 }
60
61
62
63
64
65
66 /***
67 * Note: hashCode() has not been overriden
68 *
69 * @param obj
70 */
71 public boolean equals(java.lang.Object obj)
72 {
73 if ( this == obj )
74 return true;
75
76 if (super.equals(obj)==false)
77 return false;
78
79 if (obj instanceof Source) {
80
81 Source temp = (Source)obj;
82 if (this._content != null) {
83 if (temp._content == null) return false;
84 else if (!(this._content.equals(temp._content)))
85 return false;
86 }
87 else if (temp._content != null)
88 return false;
89 if (this._format != null) {
90 if (temp._format == null) return false;
91 else if (!(this._format.equals(temp._format)))
92 return false;
93 }
94 else if (temp._format != null)
95 return false;
96 return true;
97 }
98 return false;
99 }
100
101 /***
102 * Returns the value of field 'content'. The field 'content'
103 * has the following description: internal content storage
104 *
105 * @return the value of field 'content'.
106 */
107 public java.lang.String getContent()
108 {
109 return this._content;
110 }
111
112 /***
113 * Returns the value of field 'format'. The field 'format' has
114 * the following description: The reference format. Recognized
115 * values include "bibcode",
116 * refering to a standard astronomical bibcode bibcode
117 * (http://cdsweb.u-strasbg.fr/simbad/refcode.html).
118 *
119 *
120 * @return the value of field 'format'.
121 */
122 public java.lang.String getFormat()
123 {
124 return this._format;
125 }
126
127 /***
128 * Method isValid
129 */
130 public boolean isValid()
131 {
132 try {
133 validate();
134 }
135 catch (org.exolab.castor.xml.ValidationException vex) {
136 return false;
137 }
138 return true;
139 }
140
141 /***
142 * Method marshal
143 *
144 * @param out
145 */
146 public void marshal(java.io.Writer out)
147 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
148 {
149
150 Marshaller.marshal(this, out);
151 }
152
153 /***
154 * Method marshal
155 *
156 * @param handler
157 */
158 public void marshal(org.xml.sax.ContentHandler handler)
159 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
160 {
161
162 Marshaller.marshal(this, handler);
163 }
164
165 /***
166 * Sets the value of field 'content'. The field 'content' has
167 * the following description: internal content storage
168 *
169 * @param content the value of field 'content'.
170 */
171 public void setContent(java.lang.String content)
172 {
173 this._content = content;
174 }
175
176 /***
177 * Sets the value of field 'format'. The field 'format' has the
178 * following description: The reference format. Recognized
179 * values include "bibcode",
180 * refering to a standard astronomical bibcode bibcode
181 * (http://cdsweb.u-strasbg.fr/simbad/refcode.html).
182 *
183 *
184 * @param format the value of field 'format'.
185 */
186 public void setFormat(java.lang.String format)
187 {
188 this._format = format;
189 }
190
191 /***
192 * Method unmarshalSource
193 *
194 * @param reader
195 */
196 public static org.astrogrid.registry.beans.v10.resource.Source unmarshalSource(java.io.Reader reader)
197 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
198 {
199 return (org.astrogrid.registry.beans.v10.resource.Source) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Source.class, reader);
200 }
201
202 /***
203 * Method validate
204 */
205 public void validate()
206 throws org.exolab.castor.xml.ValidationException
207 {
208 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
209 validator.validate(this);
210 }
211
212 }