2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2.descriptors;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.schemabinding.version2.JSeq;
30 * Class JSeqDescriptor.
32 * @version $Revision$ $Date$
34 public class JSeqDescriptor extends
35 org.exolab.castor.xml.util.XMLClassDescriptorImpl
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * Field _elementDefinition.
45 private boolean _elementDefinition;
50 private java.lang.String _nsPrefix;
55 private java.lang.String _nsURI;
60 private java.lang.String _xmlName;
66 public JSeqDescriptor()
69 _nsURI = "www.jalview.org";
71 _elementDefinition = true;
73 // -- set grouping compositor
74 setCompositorAsSequence();
75 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
76 org.exolab.castor.mapping.FieldHandler handler = null;
77 org.exolab.castor.xml.FieldValidator fieldValidator = null;
78 // -- initialize attribute descriptors
81 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
82 java.lang.Integer.TYPE, "_colour", "colour",
83 org.exolab.castor.xml.NodeType.Attribute);
84 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())
94 return new java.lang.Integer(target.getColour());
97 public void setValue(java.lang.Object object, java.lang.Object value)
98 throws IllegalStateException, IllegalArgumentException
102 JSeq target = (JSeq) object;
103 // if null, use delete method for optional primitives
106 target.deleteColour();
109 target.setColour(((java.lang.Integer) value).intValue());
110 } catch (java.lang.Exception ex)
112 throw new IllegalStateException(ex.toString());
116 public java.lang.Object newInstance(java.lang.Object parent)
121 desc.setHandler(handler);
122 desc.setMultivalued(false);
123 addFieldDescriptor(desc);
125 // -- validation code for: _colour
126 fieldValidator = new org.exolab.castor.xml.FieldValidator();
128 org.exolab.castor.xml.validators.IntValidator typeValidator;
129 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
130 fieldValidator.setValidator(typeValidator);
131 typeValidator.setMinInclusive(-2147483648);
132 typeValidator.setMaxInclusive(2147483647);
134 desc.setValidator(fieldValidator);
136 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
137 java.lang.Integer.TYPE, "_start", "start",
138 org.exolab.castor.xml.NodeType.Attribute);
139 handler = new org.exolab.castor.xml.XMLFieldHandler()
141 public java.lang.Object getValue(java.lang.Object object)
142 throws IllegalStateException
144 JSeq target = (JSeq) object;
145 if (!target.hasStart())
149 return new java.lang.Integer(target.getStart());
152 public void setValue(java.lang.Object object, java.lang.Object value)
153 throws IllegalStateException, IllegalArgumentException
157 JSeq target = (JSeq) object;
158 // ignore null values for non optional primitives
164 target.setStart(((java.lang.Integer) value).intValue());
165 } catch (java.lang.Exception ex)
167 throw new IllegalStateException(ex.toString());
171 public java.lang.Object newInstance(java.lang.Object parent)
176 desc.setHandler(handler);
177 desc.setRequired(true);
178 desc.setMultivalued(false);
179 addFieldDescriptor(desc);
181 // -- validation code for: _start
182 fieldValidator = new org.exolab.castor.xml.FieldValidator();
183 fieldValidator.setMinOccurs(1);
185 org.exolab.castor.xml.validators.IntValidator typeValidator;
186 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
187 fieldValidator.setValidator(typeValidator);
188 typeValidator.setMinInclusive(-2147483648);
189 typeValidator.setMaxInclusive(2147483647);
191 desc.setValidator(fieldValidator);
193 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
194 java.lang.Integer.TYPE, "_end", "end",
195 org.exolab.castor.xml.NodeType.Attribute);
196 handler = new org.exolab.castor.xml.XMLFieldHandler()
198 public java.lang.Object getValue(java.lang.Object object)
199 throws IllegalStateException
201 JSeq target = (JSeq) object;
202 if (!target.hasEnd())
206 return new java.lang.Integer(target.getEnd());
209 public void setValue(java.lang.Object object, java.lang.Object value)
210 throws IllegalStateException, IllegalArgumentException
214 JSeq target = (JSeq) object;
215 // ignore null values for non optional primitives
221 target.setEnd(((java.lang.Integer) value).intValue());
222 } catch (java.lang.Exception ex)
224 throw new IllegalStateException(ex.toString());
228 public java.lang.Object newInstance(java.lang.Object parent)
233 desc.setHandler(handler);
234 desc.setRequired(true);
235 desc.setMultivalued(false);
236 addFieldDescriptor(desc);
238 // -- validation code for: _end
239 fieldValidator = new org.exolab.castor.xml.FieldValidator();
240 fieldValidator.setMinOccurs(1);
242 org.exolab.castor.xml.validators.IntValidator typeValidator;
243 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
244 fieldValidator.setValidator(typeValidator);
245 typeValidator.setMinInclusive(-2147483648);
246 typeValidator.setMaxInclusive(2147483647);
248 desc.setValidator(fieldValidator);
250 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
251 java.lang.String.class, "_id", "id",
252 org.exolab.castor.xml.NodeType.Attribute);
253 desc.setImmutable(true);
254 handler = new org.exolab.castor.xml.XMLFieldHandler()
256 public java.lang.Object getValue(java.lang.Object object)
257 throws IllegalStateException
259 JSeq target = (JSeq) object;
260 return target.getId();
263 public void setValue(java.lang.Object object, java.lang.Object value)
264 throws IllegalStateException, IllegalArgumentException
268 JSeq target = (JSeq) object;
269 target.setId((java.lang.String) value);
270 } catch (java.lang.Exception ex)
272 throw new IllegalStateException(ex.toString());
276 public java.lang.Object newInstance(java.lang.Object parent)
281 desc.setHandler(handler);
282 desc.setRequired(true);
283 desc.setMultivalued(false);
284 addFieldDescriptor(desc);
286 // -- validation code for: _id
287 fieldValidator = new org.exolab.castor.xml.FieldValidator();
288 fieldValidator.setMinOccurs(1);
290 org.exolab.castor.xml.validators.StringValidator typeValidator;
291 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
292 fieldValidator.setValidator(typeValidator);
293 typeValidator.setWhiteSpace("preserve");
295 desc.setValidator(fieldValidator);
297 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
298 java.lang.Boolean.TYPE, "_hidden", "hidden",
299 org.exolab.castor.xml.NodeType.Attribute);
300 handler = new org.exolab.castor.xml.XMLFieldHandler()
302 public java.lang.Object getValue(java.lang.Object object)
303 throws IllegalStateException
305 JSeq target = (JSeq) object;
306 if (!target.hasHidden())
310 return (target.getHidden() ? java.lang.Boolean.TRUE
311 : java.lang.Boolean.FALSE);
314 public void setValue(java.lang.Object object, java.lang.Object value)
315 throws IllegalStateException, IllegalArgumentException
319 JSeq target = (JSeq) object;
320 // if null, use delete method for optional primitives
323 target.deleteHidden();
326 target.setHidden(((java.lang.Boolean) value).booleanValue());
327 } catch (java.lang.Exception ex)
329 throw new IllegalStateException(ex.toString());
333 public java.lang.Object newInstance(java.lang.Object parent)
338 desc.setHandler(handler);
339 desc.setMultivalued(false);
340 addFieldDescriptor(desc);
342 // -- validation code for: _hidden
343 fieldValidator = new org.exolab.castor.xml.FieldValidator();
345 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
346 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
347 fieldValidator.setValidator(typeValidator);
349 desc.setValidator(fieldValidator);
350 // -- initialize element descriptors
353 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
354 jalview.schemabinding.version2.Features.class, "_featuresList",
355 "features", org.exolab.castor.xml.NodeType.Element);
356 handler = new org.exolab.castor.xml.XMLFieldHandler()
358 public java.lang.Object getValue(java.lang.Object object)
359 throws IllegalStateException
361 JSeq target = (JSeq) object;
362 return target.getFeatures();
365 public void setValue(java.lang.Object object, java.lang.Object value)
366 throws IllegalStateException, IllegalArgumentException
370 JSeq target = (JSeq) object;
371 target.addFeatures((jalview.schemabinding.version2.Features) value);
372 } catch (java.lang.Exception ex)
374 throw new IllegalStateException(ex.toString());
378 public void resetValue(Object object) throws IllegalStateException,
379 IllegalArgumentException
383 JSeq target = (JSeq) object;
384 target.removeAllFeatures();
385 } catch (java.lang.Exception ex)
387 throw new IllegalStateException(ex.toString());
391 public java.lang.Object newInstance(java.lang.Object parent)
393 return new jalview.schemabinding.version2.Features();
396 desc.setHandler(handler);
397 desc.setNameSpaceURI("www.jalview.org");
398 desc.setMultivalued(true);
399 addFieldDescriptor(desc);
401 // -- validation code for: _featuresList
402 fieldValidator = new org.exolab.castor.xml.FieldValidator();
403 fieldValidator.setMinOccurs(0);
406 desc.setValidator(fieldValidator);
408 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
409 jalview.schemabinding.version2.Pdbids.class, "_pdbidsList",
410 "pdbids", org.exolab.castor.xml.NodeType.Element);
411 handler = new org.exolab.castor.xml.XMLFieldHandler()
413 public java.lang.Object getValue(java.lang.Object object)
414 throws IllegalStateException
416 JSeq target = (JSeq) object;
417 return target.getPdbids();
420 public void setValue(java.lang.Object object, java.lang.Object value)
421 throws IllegalStateException, IllegalArgumentException
425 JSeq target = (JSeq) object;
426 target.addPdbids((jalview.schemabinding.version2.Pdbids) value);
427 } catch (java.lang.Exception ex)
429 throw new IllegalStateException(ex.toString());
433 public void resetValue(Object object) throws IllegalStateException,
434 IllegalArgumentException
438 JSeq target = (JSeq) object;
439 target.removeAllPdbids();
440 } catch (java.lang.Exception ex)
442 throw new IllegalStateException(ex.toString());
446 public java.lang.Object newInstance(java.lang.Object parent)
448 return new jalview.schemabinding.version2.Pdbids();
451 desc.setHandler(handler);
452 desc.setNameSpaceURI("www.jalview.org");
453 desc.setMultivalued(true);
454 addFieldDescriptor(desc);
456 // -- validation code for: _pdbidsList
457 fieldValidator = new org.exolab.castor.xml.FieldValidator();
458 fieldValidator.setMinOccurs(0);
461 desc.setValidator(fieldValidator);
462 // -- _hiddenSequencesList
463 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
464 java.lang.Integer.TYPE, "_hiddenSequencesList",
465 "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
466 handler = new org.exolab.castor.xml.XMLFieldHandler()
468 public java.lang.Object getValue(java.lang.Object object)
469 throws IllegalStateException
471 JSeq target = (JSeq) object;
472 return target.getHiddenSequences();
475 public void setValue(java.lang.Object object, java.lang.Object value)
476 throws IllegalStateException, IllegalArgumentException
480 JSeq target = (JSeq) object;
481 // ignore null values for non optional primitives
487 target.addHiddenSequences(((java.lang.Integer) value).intValue());
488 } catch (java.lang.Exception ex)
490 throw new IllegalStateException(ex.toString());
494 public void resetValue(Object object) throws IllegalStateException,
495 IllegalArgumentException
499 JSeq target = (JSeq) object;
500 target.removeAllHiddenSequences();
501 } catch (java.lang.Exception ex)
503 throw new IllegalStateException(ex.toString());
507 public java.lang.Object newInstance(java.lang.Object parent)
512 desc.setHandler(handler);
513 desc.setNameSpaceURI("www.jalview.org");
514 desc.setMultivalued(true);
515 addFieldDescriptor(desc);
517 // -- validation code for: _hiddenSequencesList
518 fieldValidator = new org.exolab.castor.xml.FieldValidator();
519 fieldValidator.setMinOccurs(0);
521 org.exolab.castor.xml.validators.IntValidator typeValidator;
522 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
523 fieldValidator.setValidator(typeValidator);
524 typeValidator.setMinInclusive(-2147483648);
525 typeValidator.setMaxInclusive(2147483647);
527 desc.setValidator(fieldValidator);
535 * Method getAccessMode.
537 * @return the access mode specified for this class.
539 public org.exolab.castor.mapping.AccessMode getAccessMode()
545 * Method getIdentity.
547 * @return the identity field, null if this class has no identity.
549 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
551 return super.getIdentity();
555 * Method getJavaClass.
557 * @return the Java class represented by this descriptor.
559 public java.lang.Class getJavaClass()
561 return jalview.schemabinding.version2.JSeq.class;
565 * Method getNameSpacePrefix.
567 * @return the namespace prefix to use when marshaling as XML.
569 public java.lang.String getNameSpacePrefix()
575 * Method getNameSpaceURI.
577 * @return the namespace URI used when marshaling and unmarshaling as XML.
579 public java.lang.String getNameSpaceURI()
585 * Method getValidator.
587 * @return a specific validator for the class described by this
590 public org.exolab.castor.xml.TypeValidator getValidator()
598 * @return the XML Name for the Class being described.
600 public java.lang.String getXMLName()
606 * Method isElementDefinition.
608 * @return true if XML schema definition of this Class is that of a global
609 * element or element with anonymous type definition.
611 public boolean isElementDefinition()
613 return _elementDefinition;