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