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