1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1.parameters;
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 * Defines what a parameterValue can contain - for the instance
26 * document
27 *
28 * @version $Revision: 1.36 $ $Date: 2007/01/04 16:26:33 $
29 */
30 public class ParameterValue extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * Field _name
41 */
42 private java.lang.String _name;
43
44 /***
45 * Field _encoding
46 */
47 private java.lang.String _encoding;
48
49 /***
50 * Field _indirect
51 */
52 private boolean _indirect = false;
53
54 /***
55 * keeps track of state for field: _indirect
56 */
57 private boolean _has_indirect;
58
59 /***
60 * Field _value
61 */
62 private java.lang.String _value;
63
64
65
66
67
68
69 public ParameterValue() {
70 super();
71 }
72
73
74
75
76
77
78 /***
79 * Method deleteIndirect
80 */
81 public void deleteIndirect()
82 {
83 this._has_indirect= false;
84 }
85
86 /***
87 * Note: hashCode() has not been overriden
88 *
89 * @param obj
90 */
91 public boolean equals(java.lang.Object obj)
92 {
93 if ( this == obj )
94 return true;
95
96 if (super.equals(obj)==false)
97 return false;
98
99 if (obj instanceof ParameterValue) {
100
101 ParameterValue temp = (ParameterValue)obj;
102 if (this._name != null) {
103 if (temp._name == null) return false;
104 else if (!(this._name.equals(temp._name)))
105 return false;
106 }
107 else if (temp._name != null)
108 return false;
109 if (this._encoding != null) {
110 if (temp._encoding == null) return false;
111 else if (!(this._encoding.equals(temp._encoding)))
112 return false;
113 }
114 else if (temp._encoding != null)
115 return false;
116 if (this._indirect != temp._indirect)
117 return false;
118 if (this._has_indirect != temp._has_indirect)
119 return false;
120 if (this._value != null) {
121 if (temp._value == null) return false;
122 else if (!(this._value.equals(temp._value)))
123 return false;
124 }
125 else if (temp._value != null)
126 return false;
127 return true;
128 }
129 return false;
130 }
131
132 /***
133 * Returns the value of field 'encoding'.
134 *
135 * @return the value of field 'encoding'.
136 */
137 public java.lang.String getEncoding()
138 {
139 return this._encoding;
140 }
141
142 /***
143 * Returns the value of field 'indirect'.
144 *
145 * @return the value of field 'indirect'.
146 */
147 public boolean getIndirect()
148 {
149 return this._indirect;
150 }
151
152 /***
153 * Returns the value of field 'name'.
154 *
155 * @return the value of field 'name'.
156 */
157 public java.lang.String getName()
158 {
159 return this._name;
160 }
161
162 /***
163 * Returns the value of field 'value'.
164 *
165 * @return the value of field 'value'.
166 */
167 public java.lang.String getValue()
168 {
169 return this._value;
170 }
171
172 /***
173 * Method hasIndirect
174 */
175 public boolean hasIndirect()
176 {
177 return this._has_indirect;
178 }
179
180 /***
181 * Method isValid
182 */
183 public boolean isValid()
184 {
185 try {
186 validate();
187 }
188 catch (org.exolab.castor.xml.ValidationException vex) {
189 return false;
190 }
191 return true;
192 }
193
194 /***
195 * Method marshal
196 *
197 * @param out
198 */
199 public void marshal(java.io.Writer out)
200 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
201 {
202
203 Marshaller.marshal(this, out);
204 }
205
206 /***
207 * Method marshal
208 *
209 * @param handler
210 */
211 public void marshal(org.xml.sax.ContentHandler handler)
212 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
213 {
214
215 Marshaller.marshal(this, handler);
216 }
217
218 /***
219 * Sets the value of field 'encoding'.
220 *
221 * @param encoding the value of field 'encoding'.
222 */
223 public void setEncoding(java.lang.String encoding)
224 {
225 this._encoding = encoding;
226 }
227
228 /***
229 * Sets the value of field 'indirect'.
230 *
231 * @param indirect the value of field 'indirect'.
232 */
233 public void setIndirect(boolean indirect)
234 {
235 this._indirect = indirect;
236 this._has_indirect = true;
237 }
238
239 /***
240 * Sets the value of field 'name'.
241 *
242 * @param name the value of field 'name'.
243 */
244 public void setName(java.lang.String name)
245 {
246 this._name = name;
247 }
248
249 /***
250 * Sets the value of field 'value'.
251 *
252 * @param value the value of field 'value'.
253 */
254 public void setValue(java.lang.String value)
255 {
256 this._value = value;
257 }
258
259 /***
260 * Method unmarshalParameterValue
261 *
262 * @param reader
263 */
264 public static org.astrogrid.applications.beans.v1.parameters.ParameterValue unmarshalParameterValue(java.io.Reader reader)
265 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
266 {
267 return (org.astrogrid.applications.beans.v1.parameters.ParameterValue) Unmarshaller.unmarshal(org.astrogrid.applications.beans.v1.parameters.ParameterValue.class, reader);
268 }
269
270 /***
271 * Method validate
272 */
273 public void validate()
274 throws org.exolab.castor.xml.ValidationException
275 {
276 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
277 validator.validate(this);
278 }
279
280 }