1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.votable;
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 TD.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:14 $
28 */
29 public class TD extends org.astrogrid.registry.beans.resource.votable.AnyTEXT
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * Field _ref
40 */
41 private java.lang.Object _ref;
42
43 /***
44 * internal content storage
45 */
46 private java.lang.String _content = "";
47
48
49
50
51
52
53 public TD() {
54 super();
55 setContent("");
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 TD) {
77
78 TD temp = (TD)obj;
79 if (this._ref != null) {
80 if (temp._ref == null) return false;
81 else if (!(this._ref.equals(temp._ref)))
82 return false;
83 }
84 else if (temp._ref != null)
85 return false;
86 if (this._content != null) {
87 if (temp._content == null) return false;
88 else if (!(this._content.equals(temp._content)))
89 return false;
90 }
91 else if (temp._content != null)
92 return false;
93 return true;
94 }
95 return false;
96 }
97
98 /***
99 * Returns the value of field 'content'. The field 'content'
100 * has the following description: internal content storage
101 *
102 * @return the value of field 'content'.
103 */
104 public java.lang.String getContent()
105 {
106 return this._content;
107 }
108
109 /***
110 * Returns the value of field 'ref'.
111 *
112 * @return the value of field 'ref'.
113 */
114 public java.lang.Object getRef()
115 {
116 return this._ref;
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 'content'. The field 'content' has
159 * the following description: internal content storage
160 *
161 * @param content the value of field 'content'.
162 */
163 public void setContent(java.lang.String content)
164 {
165 this._content = content;
166 }
167
168 /***
169 * Sets the value of field 'ref'.
170 *
171 * @param ref the value of field 'ref'.
172 */
173 public void setRef(java.lang.Object ref)
174 {
175 this._ref = ref;
176 }
177
178 /***
179 * Method unmarshalTD
180 *
181 * @param reader
182 */
183 public static org.astrogrid.registry.beans.resource.votable.TD unmarshalTD(java.io.Reader reader)
184 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
185 {
186 return (org.astrogrid.registry.beans.resource.votable.TD) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.votable.TD.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 }