2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.JSeq;
28 * Class JSeqDescriptor.
30 * @version $Revision$ $Date$
32 public class JSeqDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public JSeqDescriptor()
67 _nsURI = "www.jalview.org";
69 _elementDefinition = true;
71 // -- set grouping compositor
72 setCompositorAsSequence();
73 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
74 org.exolab.castor.mapping.FieldHandler handler = null;
75 org.exolab.castor.xml.FieldValidator fieldValidator = null;
76 // -- initialize attribute descriptors
79 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
80 java.lang.Integer.TYPE, "_colour", "colour",
81 org.exolab.castor.xml.NodeType.Attribute);
82 handler = new org.exolab.castor.xml.XMLFieldHandler()
84 public java.lang.Object getValue(java.lang.Object object)
85 throws IllegalStateException
87 JSeq target = (JSeq) object;
88 if (!target.hasColour())
92 return new java.lang.Integer(target.getColour());
95 public void setValue(java.lang.Object object, java.lang.Object value)
96 throws IllegalStateException, IllegalArgumentException
100 JSeq target = (JSeq) object;
101 // if null, use delete method for optional primitives
104 target.deleteColour();
107 target.setColour(((java.lang.Integer) value).intValue());
108 } catch (java.lang.Exception ex)
110 throw new IllegalStateException(ex.toString());
114 public java.lang.Object newInstance(java.lang.Object parent)
119 desc.setHandler(handler);
120 desc.setMultivalued(false);
121 addFieldDescriptor(desc);
123 // -- validation code for: _colour
124 fieldValidator = new org.exolab.castor.xml.FieldValidator();
126 org.exolab.castor.xml.validators.IntValidator typeValidator;
127 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
128 fieldValidator.setValidator(typeValidator);
129 typeValidator.setMinInclusive(-2147483648);
130 typeValidator.setMaxInclusive(2147483647);
132 desc.setValidator(fieldValidator);
134 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
135 java.lang.Integer.TYPE, "_start", "start",
136 org.exolab.castor.xml.NodeType.Attribute);
137 handler = new org.exolab.castor.xml.XMLFieldHandler()
139 public java.lang.Object getValue(java.lang.Object object)
140 throws IllegalStateException
142 JSeq target = (JSeq) object;
143 if (!target.hasStart())
147 return new java.lang.Integer(target.getStart());
150 public void setValue(java.lang.Object object, java.lang.Object value)
151 throws IllegalStateException, IllegalArgumentException
155 JSeq target = (JSeq) object;
156 // ignore null values for non optional primitives
162 target.setStart(((java.lang.Integer) value).intValue());
163 } catch (java.lang.Exception ex)
165 throw new IllegalStateException(ex.toString());
169 public java.lang.Object newInstance(java.lang.Object parent)
174 desc.setHandler(handler);
175 desc.setRequired(true);
176 desc.setMultivalued(false);
177 addFieldDescriptor(desc);
179 // -- validation code for: _start
180 fieldValidator = new org.exolab.castor.xml.FieldValidator();
181 fieldValidator.setMinOccurs(1);
183 org.exolab.castor.xml.validators.IntValidator typeValidator;
184 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
185 fieldValidator.setValidator(typeValidator);
186 typeValidator.setMinInclusive(-2147483648);
187 typeValidator.setMaxInclusive(2147483647);
189 desc.setValidator(fieldValidator);
191 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
192 java.lang.Integer.TYPE, "_end", "end",
193 org.exolab.castor.xml.NodeType.Attribute);
194 handler = new org.exolab.castor.xml.XMLFieldHandler()
196 public java.lang.Object getValue(java.lang.Object object)
197 throws IllegalStateException
199 JSeq target = (JSeq) object;
200 if (!target.hasEnd())
204 return new java.lang.Integer(target.getEnd());
207 public void setValue(java.lang.Object object, java.lang.Object value)
208 throws IllegalStateException, IllegalArgumentException
212 JSeq target = (JSeq) object;
213 // ignore null values for non optional primitives
219 target.setEnd(((java.lang.Integer) value).intValue());
220 } catch (java.lang.Exception ex)
222 throw new IllegalStateException(ex.toString());
226 public java.lang.Object newInstance(java.lang.Object parent)
231 desc.setHandler(handler);
232 desc.setRequired(true);
233 desc.setMultivalued(false);
234 addFieldDescriptor(desc);
236 // -- validation code for: _end
237 fieldValidator = new org.exolab.castor.xml.FieldValidator();
238 fieldValidator.setMinOccurs(1);
240 org.exolab.castor.xml.validators.IntValidator typeValidator;
241 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
242 fieldValidator.setValidator(typeValidator);
243 typeValidator.setMinInclusive(-2147483648);
244 typeValidator.setMaxInclusive(2147483647);
246 desc.setValidator(fieldValidator);
248 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
249 java.lang.String.class, "_id", "id",
250 org.exolab.castor.xml.NodeType.Attribute);
251 desc.setImmutable(true);
252 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 return target.getId();
261 public void setValue(java.lang.Object object, java.lang.Object value)
262 throws IllegalStateException, IllegalArgumentException
266 JSeq target = (JSeq) object;
267 target.setId((java.lang.String) value);
268 } catch (java.lang.Exception ex)
270 throw new IllegalStateException(ex.toString());
274 public java.lang.Object newInstance(java.lang.Object parent)
279 desc.setHandler(handler);
280 desc.setRequired(true);
281 desc.setMultivalued(false);
282 addFieldDescriptor(desc);
284 // -- validation code for: _id
285 fieldValidator = new org.exolab.castor.xml.FieldValidator();
286 fieldValidator.setMinOccurs(1);
288 org.exolab.castor.xml.validators.StringValidator typeValidator;
289 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
290 fieldValidator.setValidator(typeValidator);
291 typeValidator.setWhiteSpace("preserve");
293 desc.setValidator(fieldValidator);
295 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
296 java.lang.Boolean.TYPE, "_hidden", "hidden",
297 org.exolab.castor.xml.NodeType.Attribute);
298 handler = new org.exolab.castor.xml.XMLFieldHandler()
300 public java.lang.Object getValue(java.lang.Object object)
301 throws IllegalStateException
303 JSeq target = (JSeq) object;
304 if (!target.hasHidden())
308 return (target.getHidden() ? java.lang.Boolean.TRUE
309 : java.lang.Boolean.FALSE);
312 public void setValue(java.lang.Object object, java.lang.Object value)
313 throws IllegalStateException, IllegalArgumentException
317 JSeq target = (JSeq) object;
318 // if null, use delete method for optional primitives
321 target.deleteHidden();
324 target.setHidden(((java.lang.Boolean) value).booleanValue());
325 } catch (java.lang.Exception ex)
327 throw new IllegalStateException(ex.toString());
331 public java.lang.Object newInstance(java.lang.Object parent)
336 desc.setHandler(handler);
337 desc.setMultivalued(false);
338 addFieldDescriptor(desc);
340 // -- validation code for: _hidden
341 fieldValidator = new org.exolab.castor.xml.FieldValidator();
343 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
344 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
345 fieldValidator.setValidator(typeValidator);
347 desc.setValidator(fieldValidator);
348 // -- initialize element descriptors
351 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
352 jalview.schemabinding.version2.Features.class, "_featuresList",
353 "features", org.exolab.castor.xml.NodeType.Element);
354 handler = new org.exolab.castor.xml.XMLFieldHandler()
356 public java.lang.Object getValue(java.lang.Object object)
357 throws IllegalStateException
359 JSeq target = (JSeq) object;
360 return target.getFeatures();
363 public void setValue(java.lang.Object object, java.lang.Object value)
364 throws IllegalStateException, IllegalArgumentException
368 JSeq target = (JSeq) object;
369 target.addFeatures((jalview.schemabinding.version2.Features) value);
370 } catch (java.lang.Exception ex)
372 throw new IllegalStateException(ex.toString());
376 public void resetValue(Object object) throws IllegalStateException,
377 IllegalArgumentException
381 JSeq target = (JSeq) object;
382 target.removeAllFeatures();
383 } catch (java.lang.Exception ex)
385 throw new IllegalStateException(ex.toString());
389 public java.lang.Object newInstance(java.lang.Object parent)
391 return new jalview.schemabinding.version2.Features();
394 desc.setHandler(handler);
395 desc.setNameSpaceURI("www.jalview.org");
396 desc.setMultivalued(true);
397 addFieldDescriptor(desc);
399 // -- validation code for: _featuresList
400 fieldValidator = new org.exolab.castor.xml.FieldValidator();
401 fieldValidator.setMinOccurs(0);
404 desc.setValidator(fieldValidator);
406 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
407 jalview.schemabinding.version2.Pdbids.class, "_pdbidsList",
408 "pdbids", org.exolab.castor.xml.NodeType.Element);
409 handler = new org.exolab.castor.xml.XMLFieldHandler()
411 public java.lang.Object getValue(java.lang.Object object)
412 throws IllegalStateException
414 JSeq target = (JSeq) object;
415 return target.getPdbids();
418 public void setValue(java.lang.Object object, java.lang.Object value)
419 throws IllegalStateException, IllegalArgumentException
423 JSeq target = (JSeq) object;
424 target.addPdbids((jalview.schemabinding.version2.Pdbids) value);
425 } catch (java.lang.Exception ex)
427 throw new IllegalStateException(ex.toString());
431 public void resetValue(Object object) throws IllegalStateException,
432 IllegalArgumentException
436 JSeq target = (JSeq) object;
437 target.removeAllPdbids();
438 } catch (java.lang.Exception ex)
440 throw new IllegalStateException(ex.toString());
444 public java.lang.Object newInstance(java.lang.Object parent)
446 return new jalview.schemabinding.version2.Pdbids();
449 desc.setHandler(handler);
450 desc.setNameSpaceURI("www.jalview.org");
451 desc.setMultivalued(true);
452 addFieldDescriptor(desc);
454 // -- validation code for: _pdbidsList
455 fieldValidator = new org.exolab.castor.xml.FieldValidator();
456 fieldValidator.setMinOccurs(0);
459 desc.setValidator(fieldValidator);
460 // -- _hiddenSequencesList
461 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
462 java.lang.Integer.TYPE, "_hiddenSequencesList",
463 "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
464 handler = new org.exolab.castor.xml.XMLFieldHandler()
466 public java.lang.Object getValue(java.lang.Object object)
467 throws IllegalStateException
469 JSeq target = (JSeq) object;
470 return target.getHiddenSequences();
473 public void setValue(java.lang.Object object, java.lang.Object value)
474 throws IllegalStateException, IllegalArgumentException
478 JSeq target = (JSeq) object;
479 // ignore null values for non optional primitives
485 target.addHiddenSequences(((java.lang.Integer) value).intValue());
486 } catch (java.lang.Exception ex)
488 throw new IllegalStateException(ex.toString());
492 public void resetValue(Object object) throws IllegalStateException,
493 IllegalArgumentException
497 JSeq target = (JSeq) object;
498 target.removeAllHiddenSequences();
499 } catch (java.lang.Exception ex)
501 throw new IllegalStateException(ex.toString());
505 public java.lang.Object newInstance(java.lang.Object parent)
510 desc.setHandler(handler);
511 desc.setNameSpaceURI("www.jalview.org");
512 desc.setMultivalued(true);
513 addFieldDescriptor(desc);
515 // -- validation code for: _hiddenSequencesList
516 fieldValidator = new org.exolab.castor.xml.FieldValidator();
517 fieldValidator.setMinOccurs(0);
519 org.exolab.castor.xml.validators.IntValidator typeValidator;
520 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
521 fieldValidator.setValidator(typeValidator);
522 typeValidator.setMinInclusive(-2147483648);
523 typeValidator.setMaxInclusive(2147483647);
525 desc.setValidator(fieldValidator);
533 * Method getAccessMode.
535 * @return the access mode specified for this class.
537 public org.exolab.castor.mapping.AccessMode getAccessMode()
543 * Method getIdentity.
545 * @return the identity field, null if this class has no identity.
547 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
549 return super.getIdentity();
553 * Method getJavaClass.
555 * @return the Java class represented by this descriptor.
557 public java.lang.Class getJavaClass()
559 return jalview.schemabinding.version2.JSeq.class;
563 * Method getNameSpacePrefix.
565 * @return the namespace prefix to use when marshaling as XML.
567 public java.lang.String getNameSpacePrefix()
573 * Method getNameSpaceURI.
575 * @return the namespace URI used when marshaling and unmarshaling as XML.
577 public java.lang.String getNameSpaceURI()
583 * Method getValidator.
585 * @return a specific validator for the class described by this
588 public org.exolab.castor.xml.TypeValidator getValidator()
596 * @return the XML Name for the Class being described.
598 public java.lang.String getXMLName()
604 * Method isElementDefinition.
606 * @return true if XML schema definition of this Class is that of a global
607 * element or element with anonymous type definition.
609 public boolean isElementDefinition()
611 return _elementDefinition;