8be5479df335d23924531aee315801402dd236fc
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / JSeqDescriptor.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  
17  * If not, see <http://www.gnu.org/licenses/>.
18  * The Jalview Authors are detailed in the 'AUTHORS' file.
19  ******************************************************************************/
20 /*
21  * This class was automatically generated with 
22  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
23  * Schema.
24  * $Id$
25  */
26
27 package jalview.schemabinding.version2.descriptors;
28
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
32
33 import jalview.schemabinding.version2.JSeq;
34
35 /**
36  * Class JSeqDescriptor.
37  * 
38  * @version $Revision$ $Date$
39  */
40 public class JSeqDescriptor extends
41         org.exolab.castor.xml.util.XMLClassDescriptorImpl
42 {
43
44   // --------------------------/
45   // - Class/Member Variables -/
46   // --------------------------/
47
48   /**
49    * Field _elementDefinition.
50    */
51   private boolean _elementDefinition;
52
53   /**
54    * Field _nsPrefix.
55    */
56   private java.lang.String _nsPrefix;
57
58   /**
59    * Field _nsURI.
60    */
61   private java.lang.String _nsURI;
62
63   /**
64    * Field _xmlName.
65    */
66   private java.lang.String _xmlName;
67
68   // ----------------/
69   // - Constructors -/
70   // ----------------/
71
72   public JSeqDescriptor()
73   {
74     super();
75     _nsURI = "www.jalview.org";
76     _xmlName = "JSeq";
77     _elementDefinition = true;
78
79     // -- set grouping compositor
80     setCompositorAsSequence();
81     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
82     org.exolab.castor.mapping.FieldHandler handler = null;
83     org.exolab.castor.xml.FieldValidator fieldValidator = null;
84     // -- initialize attribute descriptors
85
86     // -- _colour
87     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
88             java.lang.Integer.TYPE, "_colour", "colour",
89             org.exolab.castor.xml.NodeType.Attribute);
90     handler = new org.exolab.castor.xml.XMLFieldHandler()
91     {
92       public java.lang.Object getValue(java.lang.Object object)
93               throws IllegalStateException
94       {
95         JSeq target = (JSeq) object;
96         if (!target.hasColour())
97         {
98           return null;
99         }
100         return new java.lang.Integer(target.getColour());
101       }
102
103       public void setValue(java.lang.Object object, java.lang.Object value)
104               throws IllegalStateException, IllegalArgumentException
105       {
106         try
107         {
108           JSeq target = (JSeq) object;
109           // if null, use delete method for optional primitives
110           if (value == null)
111           {
112             target.deleteColour();
113             return;
114           }
115           target.setColour(((java.lang.Integer) value).intValue());
116         } catch (java.lang.Exception ex)
117         {
118           throw new IllegalStateException(ex.toString());
119         }
120       }
121
122       public java.lang.Object newInstance(java.lang.Object parent)
123       {
124         return null;
125       }
126     };
127     desc.setHandler(handler);
128     desc.setMultivalued(false);
129     addFieldDescriptor(desc);
130
131     // -- validation code for: _colour
132     fieldValidator = new org.exolab.castor.xml.FieldValidator();
133     { // -- local scope
134       org.exolab.castor.xml.validators.IntValidator typeValidator;
135       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
136       fieldValidator.setValidator(typeValidator);
137       typeValidator.setMinInclusive(-2147483648);
138       typeValidator.setMaxInclusive(2147483647);
139     }
140     desc.setValidator(fieldValidator);
141     // -- _start
142     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
143             java.lang.Integer.TYPE, "_start", "start",
144             org.exolab.castor.xml.NodeType.Attribute);
145     handler = new org.exolab.castor.xml.XMLFieldHandler()
146     {
147       public java.lang.Object getValue(java.lang.Object object)
148               throws IllegalStateException
149       {
150         JSeq target = (JSeq) object;
151         if (!target.hasStart())
152         {
153           return null;
154         }
155         return new java.lang.Integer(target.getStart());
156       }
157
158       public void setValue(java.lang.Object object, java.lang.Object value)
159               throws IllegalStateException, IllegalArgumentException
160       {
161         try
162         {
163           JSeq target = (JSeq) object;
164           // ignore null values for non optional primitives
165           if (value == null)
166           {
167             return;
168           }
169
170           target.setStart(((java.lang.Integer) value).intValue());
171         } catch (java.lang.Exception ex)
172         {
173           throw new IllegalStateException(ex.toString());
174         }
175       }
176
177       public java.lang.Object newInstance(java.lang.Object parent)
178       {
179         return null;
180       }
181     };
182     desc.setHandler(handler);
183     desc.setRequired(true);
184     desc.setMultivalued(false);
185     addFieldDescriptor(desc);
186
187     // -- validation code for: _start
188     fieldValidator = new org.exolab.castor.xml.FieldValidator();
189     fieldValidator.setMinOccurs(1);
190     { // -- local scope
191       org.exolab.castor.xml.validators.IntValidator typeValidator;
192       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
193       fieldValidator.setValidator(typeValidator);
194       typeValidator.setMinInclusive(-2147483648);
195       typeValidator.setMaxInclusive(2147483647);
196     }
197     desc.setValidator(fieldValidator);
198     // -- _end
199     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
200             java.lang.Integer.TYPE, "_end", "end",
201             org.exolab.castor.xml.NodeType.Attribute);
202     handler = new org.exolab.castor.xml.XMLFieldHandler()
203     {
204       public java.lang.Object getValue(java.lang.Object object)
205               throws IllegalStateException
206       {
207         JSeq target = (JSeq) object;
208         if (!target.hasEnd())
209         {
210           return null;
211         }
212         return new java.lang.Integer(target.getEnd());
213       }
214
215       public void setValue(java.lang.Object object, java.lang.Object value)
216               throws IllegalStateException, IllegalArgumentException
217       {
218         try
219         {
220           JSeq target = (JSeq) object;
221           // ignore null values for non optional primitives
222           if (value == null)
223           {
224             return;
225           }
226
227           target.setEnd(((java.lang.Integer) value).intValue());
228         } catch (java.lang.Exception ex)
229         {
230           throw new IllegalStateException(ex.toString());
231         }
232       }
233
234       public java.lang.Object newInstance(java.lang.Object parent)
235       {
236         return null;
237       }
238     };
239     desc.setHandler(handler);
240     desc.setRequired(true);
241     desc.setMultivalued(false);
242     addFieldDescriptor(desc);
243
244     // -- validation code for: _end
245     fieldValidator = new org.exolab.castor.xml.FieldValidator();
246     fieldValidator.setMinOccurs(1);
247     { // -- local scope
248       org.exolab.castor.xml.validators.IntValidator typeValidator;
249       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
250       fieldValidator.setValidator(typeValidator);
251       typeValidator.setMinInclusive(-2147483648);
252       typeValidator.setMaxInclusive(2147483647);
253     }
254     desc.setValidator(fieldValidator);
255     // -- _id
256     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
257             java.lang.String.class, "_id", "id",
258             org.exolab.castor.xml.NodeType.Attribute);
259     desc.setImmutable(true);
260     handler = new org.exolab.castor.xml.XMLFieldHandler()
261     {
262       public java.lang.Object getValue(java.lang.Object object)
263               throws IllegalStateException
264       {
265         JSeq target = (JSeq) object;
266         return target.getId();
267       }
268
269       public void setValue(java.lang.Object object, java.lang.Object value)
270               throws IllegalStateException, IllegalArgumentException
271       {
272         try
273         {
274           JSeq target = (JSeq) object;
275           target.setId((java.lang.String) value);
276         } catch (java.lang.Exception ex)
277         {
278           throw new IllegalStateException(ex.toString());
279         }
280       }
281
282       public java.lang.Object newInstance(java.lang.Object parent)
283       {
284         return null;
285       }
286     };
287     desc.setHandler(handler);
288     desc.setRequired(true);
289     desc.setMultivalued(false);
290     addFieldDescriptor(desc);
291
292     // -- validation code for: _id
293     fieldValidator = new org.exolab.castor.xml.FieldValidator();
294     fieldValidator.setMinOccurs(1);
295     { // -- local scope
296       org.exolab.castor.xml.validators.StringValidator typeValidator;
297       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
298       fieldValidator.setValidator(typeValidator);
299       typeValidator.setWhiteSpace("preserve");
300     }
301     desc.setValidator(fieldValidator);
302     // -- _hidden
303     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
304             java.lang.Boolean.TYPE, "_hidden", "hidden",
305             org.exolab.castor.xml.NodeType.Attribute);
306     handler = new org.exolab.castor.xml.XMLFieldHandler()
307     {
308       public java.lang.Object getValue(java.lang.Object object)
309               throws IllegalStateException
310       {
311         JSeq target = (JSeq) object;
312         if (!target.hasHidden())
313         {
314           return null;
315         }
316         return (target.getHidden() ? java.lang.Boolean.TRUE
317                 : java.lang.Boolean.FALSE);
318       }
319
320       public void setValue(java.lang.Object object, java.lang.Object value)
321               throws IllegalStateException, IllegalArgumentException
322       {
323         try
324         {
325           JSeq target = (JSeq) object;
326           // if null, use delete method for optional primitives
327           if (value == null)
328           {
329             target.deleteHidden();
330             return;
331           }
332           target.setHidden(((java.lang.Boolean) value).booleanValue());
333         } catch (java.lang.Exception ex)
334         {
335           throw new IllegalStateException(ex.toString());
336         }
337       }
338
339       public java.lang.Object newInstance(java.lang.Object parent)
340       {
341         return null;
342       }
343     };
344     desc.setHandler(handler);
345     desc.setMultivalued(false);
346     addFieldDescriptor(desc);
347
348     // -- validation code for: _hidden
349     fieldValidator = new org.exolab.castor.xml.FieldValidator();
350     { // -- local scope
351       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
352       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
353       fieldValidator.setValidator(typeValidator);
354     }
355     desc.setValidator(fieldValidator);
356     // -- initialize element descriptors
357
358     // -- _featuresList
359     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
360             jalview.schemabinding.version2.Features.class, "_featuresList",
361             "features", org.exolab.castor.xml.NodeType.Element);
362     handler = new org.exolab.castor.xml.XMLFieldHandler()
363     {
364       public java.lang.Object getValue(java.lang.Object object)
365               throws IllegalStateException
366       {
367         JSeq target = (JSeq) object;
368         return target.getFeatures();
369       }
370
371       public void setValue(java.lang.Object object, java.lang.Object value)
372               throws IllegalStateException, IllegalArgumentException
373       {
374         try
375         {
376           JSeq target = (JSeq) object;
377           target.addFeatures((jalview.schemabinding.version2.Features) value);
378         } catch (java.lang.Exception ex)
379         {
380           throw new IllegalStateException(ex.toString());
381         }
382       }
383
384       public void resetValue(Object object) throws IllegalStateException,
385               IllegalArgumentException
386       {
387         try
388         {
389           JSeq target = (JSeq) object;
390           target.removeAllFeatures();
391         } catch (java.lang.Exception ex)
392         {
393           throw new IllegalStateException(ex.toString());
394         }
395       }
396
397       public java.lang.Object newInstance(java.lang.Object parent)
398       {
399         return new jalview.schemabinding.version2.Features();
400       }
401     };
402     desc.setHandler(handler);
403     desc.setNameSpaceURI("www.jalview.org");
404     desc.setMultivalued(true);
405     addFieldDescriptor(desc);
406
407     // -- validation code for: _featuresList
408     fieldValidator = new org.exolab.castor.xml.FieldValidator();
409     fieldValidator.setMinOccurs(0);
410     { // -- local scope
411     }
412     desc.setValidator(fieldValidator);
413     // -- _pdbidsList
414     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
415             jalview.schemabinding.version2.Pdbids.class, "_pdbidsList",
416             "pdbids", org.exolab.castor.xml.NodeType.Element);
417     handler = new org.exolab.castor.xml.XMLFieldHandler()
418     {
419       public java.lang.Object getValue(java.lang.Object object)
420               throws IllegalStateException
421       {
422         JSeq target = (JSeq) object;
423         return target.getPdbids();
424       }
425
426       public void setValue(java.lang.Object object, java.lang.Object value)
427               throws IllegalStateException, IllegalArgumentException
428       {
429         try
430         {
431           JSeq target = (JSeq) object;
432           target.addPdbids((jalview.schemabinding.version2.Pdbids) value);
433         } catch (java.lang.Exception ex)
434         {
435           throw new IllegalStateException(ex.toString());
436         }
437       }
438
439       public void resetValue(Object object) throws IllegalStateException,
440               IllegalArgumentException
441       {
442         try
443         {
444           JSeq target = (JSeq) object;
445           target.removeAllPdbids();
446         } catch (java.lang.Exception ex)
447         {
448           throw new IllegalStateException(ex.toString());
449         }
450       }
451
452       public java.lang.Object newInstance(java.lang.Object parent)
453       {
454         return new jalview.schemabinding.version2.Pdbids();
455       }
456     };
457     desc.setHandler(handler);
458     desc.setNameSpaceURI("www.jalview.org");
459     desc.setMultivalued(true);
460     addFieldDescriptor(desc);
461
462     // -- validation code for: _pdbidsList
463     fieldValidator = new org.exolab.castor.xml.FieldValidator();
464     fieldValidator.setMinOccurs(0);
465     { // -- local scope
466     }
467     desc.setValidator(fieldValidator);
468     // -- _hiddenSequencesList
469     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
470             java.lang.Integer.TYPE, "_hiddenSequencesList",
471             "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
472     handler = new org.exolab.castor.xml.XMLFieldHandler()
473     {
474       public java.lang.Object getValue(java.lang.Object object)
475               throws IllegalStateException
476       {
477         JSeq target = (JSeq) object;
478         return target.getHiddenSequences();
479       }
480
481       public void setValue(java.lang.Object object, java.lang.Object value)
482               throws IllegalStateException, IllegalArgumentException
483       {
484         try
485         {
486           JSeq target = (JSeq) object;
487           // ignore null values for non optional primitives
488           if (value == null)
489           {
490             return;
491           }
492
493           target.addHiddenSequences(((java.lang.Integer) value).intValue());
494         } catch (java.lang.Exception ex)
495         {
496           throw new IllegalStateException(ex.toString());
497         }
498       }
499
500       public void resetValue(Object object) throws IllegalStateException,
501               IllegalArgumentException
502       {
503         try
504         {
505           JSeq target = (JSeq) object;
506           target.removeAllHiddenSequences();
507         } catch (java.lang.Exception ex)
508         {
509           throw new IllegalStateException(ex.toString());
510         }
511       }
512
513       public java.lang.Object newInstance(java.lang.Object parent)
514       {
515         return null;
516       }
517     };
518     desc.setHandler(handler);
519     desc.setNameSpaceURI("www.jalview.org");
520     desc.setMultivalued(true);
521     addFieldDescriptor(desc);
522
523     // -- validation code for: _hiddenSequencesList
524     fieldValidator = new org.exolab.castor.xml.FieldValidator();
525     fieldValidator.setMinOccurs(0);
526     { // -- local scope
527       org.exolab.castor.xml.validators.IntValidator typeValidator;
528       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
529       fieldValidator.setValidator(typeValidator);
530       typeValidator.setMinInclusive(-2147483648);
531       typeValidator.setMaxInclusive(2147483647);
532     }
533     desc.setValidator(fieldValidator);
534   }
535
536   // -----------/
537   // - Methods -/
538   // -----------/
539
540   /**
541    * Method getAccessMode.
542    * 
543    * @return the access mode specified for this class.
544    */
545   public org.exolab.castor.mapping.AccessMode getAccessMode()
546   {
547     return null;
548   }
549
550   /**
551    * Method getIdentity.
552    * 
553    * @return the identity field, null if this class has no identity.
554    */
555   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
556   {
557     return super.getIdentity();
558   }
559
560   /**
561    * Method getJavaClass.
562    * 
563    * @return the Java class represented by this descriptor.
564    */
565   public java.lang.Class getJavaClass()
566   {
567     return jalview.schemabinding.version2.JSeq.class;
568   }
569
570   /**
571    * Method getNameSpacePrefix.
572    * 
573    * @return the namespace prefix to use when marshaling as XML.
574    */
575   public java.lang.String getNameSpacePrefix()
576   {
577     return _nsPrefix;
578   }
579
580   /**
581    * Method getNameSpaceURI.
582    * 
583    * @return the namespace URI used when marshaling and unmarshaling as XML.
584    */
585   public java.lang.String getNameSpaceURI()
586   {
587     return _nsURI;
588   }
589
590   /**
591    * Method getValidator.
592    * 
593    * @return a specific validator for the class described by this
594    *         ClassDescriptor.
595    */
596   public org.exolab.castor.xml.TypeValidator getValidator()
597   {
598     return this;
599   }
600
601   /**
602    * Method getXMLName.
603    * 
604    * @return the XML Name for the Class being described.
605    */
606   public java.lang.String getXMLName()
607   {
608     return _xmlName;
609   }
610
611   /**
612    * Method isElementDefinition.
613    * 
614    * @return true if XML schema definition of this Class is that of a global
615    *         element or element with anonymous type definition.
616    */
617   public boolean isElementDefinition()
618   {
619     return _elementDefinition;
620   }
621
622 }