1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.JSeq;
34 * Class JSeqDescriptor.
36 * @version $Revision$ $Date$
38 public class JSeqDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41 //--------------------------/
42 //- Class/Member Variables -/
43 //--------------------------/
46 * Field _elementDefinition.
48 private boolean _elementDefinition;
53 private java.lang.String _nsPrefix;
58 private java.lang.String _nsURI;
63 private java.lang.String _xmlName;
70 public JSeqDescriptor() {
72 _nsURI = "www.jalview.org";
74 _elementDefinition = true;
76 //-- set grouping compositor
77 setCompositorAsSequence();
78 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79 org.exolab.castor.mapping.FieldHandler handler = null;
80 org.exolab.castor.xml.FieldValidator fieldValidator = null;
81 //-- initialize attribute descriptors
84 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
85 handler = new org.exolab.castor.xml.XMLFieldHandler() {
86 public java.lang.Object getValue( java.lang.Object object )
87 throws IllegalStateException
89 JSeq target = (JSeq) object;
90 if (!target.hasColour()) { return null; }
91 return new java.lang.Integer(target.getColour());
93 public void setValue( java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
97 JSeq target = (JSeq) object;
98 // if null, use delete method for optional primitives
100 target.deleteColour();
103 target.setColour( ((java.lang.Integer) value).intValue());
104 } catch (java.lang.Exception ex) {
105 throw new IllegalStateException(ex.toString());
108 public java.lang.Object newInstance(java.lang.Object parent) {
112 desc.setHandler(handler);
113 desc.setMultivalued(false);
114 addFieldDescriptor(desc);
116 //-- validation code for: _colour
117 fieldValidator = new org.exolab.castor.xml.FieldValidator();
119 org.exolab.castor.xml.validators.IntValidator typeValidator;
120 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
121 fieldValidator.setValidator(typeValidator);
122 typeValidator.setMinInclusive(-2147483648);
123 typeValidator.setMaxInclusive(2147483647);
125 desc.setValidator(fieldValidator);
127 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
128 handler = new org.exolab.castor.xml.XMLFieldHandler() {
129 public java.lang.Object getValue( java.lang.Object object )
130 throws IllegalStateException
132 JSeq target = (JSeq) object;
133 if (!target.hasStart()) { return null; }
134 return new java.lang.Integer(target.getStart());
136 public void setValue( java.lang.Object object, java.lang.Object value)
137 throws IllegalStateException, IllegalArgumentException
140 JSeq target = (JSeq) object;
141 // ignore null values for non optional primitives
142 if (value == null) { return; }
144 target.setStart( ((java.lang.Integer) value).intValue());
145 } catch (java.lang.Exception ex) {
146 throw new IllegalStateException(ex.toString());
149 public java.lang.Object newInstance(java.lang.Object parent) {
153 desc.setHandler(handler);
154 desc.setRequired(true);
155 desc.setMultivalued(false);
156 addFieldDescriptor(desc);
158 //-- validation code for: _start
159 fieldValidator = new org.exolab.castor.xml.FieldValidator();
160 fieldValidator.setMinOccurs(1);
162 org.exolab.castor.xml.validators.IntValidator typeValidator;
163 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
164 fieldValidator.setValidator(typeValidator);
165 typeValidator.setMinInclusive(-2147483648);
166 typeValidator.setMaxInclusive(2147483647);
168 desc.setValidator(fieldValidator);
170 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
171 handler = new org.exolab.castor.xml.XMLFieldHandler() {
172 public java.lang.Object getValue( java.lang.Object object )
173 throws IllegalStateException
175 JSeq target = (JSeq) object;
176 if (!target.hasEnd()) { return null; }
177 return new java.lang.Integer(target.getEnd());
179 public void setValue( java.lang.Object object, java.lang.Object value)
180 throws IllegalStateException, IllegalArgumentException
183 JSeq target = (JSeq) object;
184 // ignore null values for non optional primitives
185 if (value == null) { return; }
187 target.setEnd( ((java.lang.Integer) value).intValue());
188 } catch (java.lang.Exception ex) {
189 throw new IllegalStateException(ex.toString());
192 public java.lang.Object newInstance(java.lang.Object parent) {
196 desc.setHandler(handler);
197 desc.setRequired(true);
198 desc.setMultivalued(false);
199 addFieldDescriptor(desc);
201 //-- validation code for: _end
202 fieldValidator = new org.exolab.castor.xml.FieldValidator();
203 fieldValidator.setMinOccurs(1);
205 org.exolab.castor.xml.validators.IntValidator typeValidator;
206 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
207 fieldValidator.setValidator(typeValidator);
208 typeValidator.setMinInclusive(-2147483648);
209 typeValidator.setMaxInclusive(2147483647);
211 desc.setValidator(fieldValidator);
213 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
214 desc.setImmutable(true);
215 handler = new org.exolab.castor.xml.XMLFieldHandler() {
216 public java.lang.Object getValue( java.lang.Object object )
217 throws IllegalStateException
219 JSeq target = (JSeq) object;
220 return target.getId();
222 public void setValue( java.lang.Object object, java.lang.Object value)
223 throws IllegalStateException, IllegalArgumentException
226 JSeq target = (JSeq) object;
227 target.setId( (java.lang.String) value);
228 } catch (java.lang.Exception ex) {
229 throw new IllegalStateException(ex.toString());
232 public java.lang.Object newInstance(java.lang.Object parent) {
236 desc.setHandler(handler);
237 desc.setRequired(true);
238 desc.setMultivalued(false);
239 addFieldDescriptor(desc);
241 //-- validation code for: _id
242 fieldValidator = new org.exolab.castor.xml.FieldValidator();
243 fieldValidator.setMinOccurs(1);
245 org.exolab.castor.xml.validators.StringValidator typeValidator;
246 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
247 fieldValidator.setValidator(typeValidator);
248 typeValidator.setWhiteSpace("preserve");
250 desc.setValidator(fieldValidator);
252 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_hidden", "hidden", org.exolab.castor.xml.NodeType.Attribute);
253 handler = new org.exolab.castor.xml.XMLFieldHandler() {
254 public java.lang.Object getValue( java.lang.Object object )
255 throws IllegalStateException
257 JSeq target = (JSeq) object;
258 if (!target.hasHidden()) { return null; }
259 return (target.getHidden() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
261 public void setValue( java.lang.Object object, java.lang.Object value)
262 throws IllegalStateException, IllegalArgumentException
265 JSeq target = (JSeq) object;
266 // if null, use delete method for optional primitives
268 target.deleteHidden();
271 target.setHidden( ((java.lang.Boolean) value).booleanValue());
272 } catch (java.lang.Exception ex) {
273 throw new IllegalStateException(ex.toString());
276 public java.lang.Object newInstance(java.lang.Object parent) {
280 desc.setHandler(handler);
281 desc.setMultivalued(false);
282 addFieldDescriptor(desc);
284 //-- validation code for: _hidden
285 fieldValidator = new org.exolab.castor.xml.FieldValidator();
287 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
288 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
289 fieldValidator.setValidator(typeValidator);
291 desc.setValidator(fieldValidator);
292 //-- initialize element descriptors
295 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Features.class, "_featuresList", "features", org.exolab.castor.xml.NodeType.Element);
296 handler = new org.exolab.castor.xml.XMLFieldHandler() {
297 public java.lang.Object getValue( java.lang.Object object )
298 throws IllegalStateException
300 JSeq target = (JSeq) object;
301 return target.getFeatures();
303 public void setValue( java.lang.Object object, java.lang.Object value)
304 throws IllegalStateException, IllegalArgumentException
307 JSeq target = (JSeq) object;
308 target.addFeatures( (jalview.schemabinding.version2.Features) value);
309 } catch (java.lang.Exception ex) {
310 throw new IllegalStateException(ex.toString());
313 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
315 JSeq target = (JSeq) object;
316 target.removeAllFeatures();
317 } catch (java.lang.Exception ex) {
318 throw new IllegalStateException(ex.toString());
321 public java.lang.Object newInstance(java.lang.Object parent) {
322 return new jalview.schemabinding.version2.Features();
325 desc.setHandler(handler);
326 desc.setNameSpaceURI("www.jalview.org");
327 desc.setMultivalued(true);
328 addFieldDescriptor(desc);
330 //-- validation code for: _featuresList
331 fieldValidator = new org.exolab.castor.xml.FieldValidator();
332 fieldValidator.setMinOccurs(0);
335 desc.setValidator(fieldValidator);
337 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Pdbids.class, "_pdbidsList", "pdbids", org.exolab.castor.xml.NodeType.Element);
338 handler = new org.exolab.castor.xml.XMLFieldHandler() {
339 public java.lang.Object getValue( java.lang.Object object )
340 throws IllegalStateException
342 JSeq target = (JSeq) object;
343 return target.getPdbids();
345 public void setValue( java.lang.Object object, java.lang.Object value)
346 throws IllegalStateException, IllegalArgumentException
349 JSeq target = (JSeq) object;
350 target.addPdbids( (jalview.schemabinding.version2.Pdbids) value);
351 } catch (java.lang.Exception ex) {
352 throw new IllegalStateException(ex.toString());
355 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
357 JSeq target = (JSeq) object;
358 target.removeAllPdbids();
359 } catch (java.lang.Exception ex) {
360 throw new IllegalStateException(ex.toString());
363 public java.lang.Object newInstance(java.lang.Object parent) {
364 return new jalview.schemabinding.version2.Pdbids();
367 desc.setHandler(handler);
368 desc.setNameSpaceURI("www.jalview.org");
369 desc.setMultivalued(true);
370 addFieldDescriptor(desc);
372 //-- validation code for: _pdbidsList
373 fieldValidator = new org.exolab.castor.xml.FieldValidator();
374 fieldValidator.setMinOccurs(0);
377 desc.setValidator(fieldValidator);
378 //-- _hiddenSequencesList
379 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_hiddenSequencesList", "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
380 handler = new org.exolab.castor.xml.XMLFieldHandler() {
381 public java.lang.Object getValue( java.lang.Object object )
382 throws IllegalStateException
384 JSeq target = (JSeq) object;
385 return target.getHiddenSequences();
387 public void setValue( java.lang.Object object, java.lang.Object value)
388 throws IllegalStateException, IllegalArgumentException
391 JSeq target = (JSeq) object;
392 // ignore null values for non optional primitives
393 if (value == null) { return; }
395 target.addHiddenSequences( ((java.lang.Integer) value).intValue());
396 } catch (java.lang.Exception ex) {
397 throw new IllegalStateException(ex.toString());
400 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
402 JSeq target = (JSeq) object;
403 target.removeAllHiddenSequences();
404 } catch (java.lang.Exception ex) {
405 throw new IllegalStateException(ex.toString());
408 public java.lang.Object newInstance(java.lang.Object parent) {
412 desc.setHandler(handler);
413 desc.setNameSpaceURI("www.jalview.org");
414 desc.setMultivalued(true);
415 addFieldDescriptor(desc);
417 //-- validation code for: _hiddenSequencesList
418 fieldValidator = new org.exolab.castor.xml.FieldValidator();
419 fieldValidator.setMinOccurs(0);
421 org.exolab.castor.xml.validators.IntValidator typeValidator;
422 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
423 fieldValidator.setValidator(typeValidator);
424 typeValidator.setMinInclusive(-2147483648);
425 typeValidator.setMaxInclusive(2147483647);
427 desc.setValidator(fieldValidator);
436 * Method getAccessMode.
438 * @return the access mode specified for this class.
440 public org.exolab.castor.mapping.AccessMode getAccessMode(
446 * Method getIdentity.
448 * @return the identity field, null if this class has no
451 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
453 return super.getIdentity();
457 * Method getJavaClass.
459 * @return the Java class represented by this descriptor.
461 public java.lang.Class getJavaClass(
463 return jalview.schemabinding.version2.JSeq.class;
467 * Method getNameSpacePrefix.
469 * @return the namespace prefix to use when marshaling as XML.
471 public java.lang.String getNameSpacePrefix(
477 * Method getNameSpaceURI.
479 * @return the namespace URI used when marshaling and
480 * unmarshaling as XML.
482 public java.lang.String getNameSpaceURI(
488 * Method getValidator.
490 * @return a specific validator for the class described by this
493 public org.exolab.castor.xml.TypeValidator getValidator(
501 * @return the XML Name for the Class being described.
503 public java.lang.String getXMLName(
509 * Method isElementDefinition.
511 * @return true if XML schema definition of this Class is that
513 * element or element with anonymous type definition.
515 public boolean isElementDefinition(
517 return _elementDefinition;