1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2.descriptors;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import jalview.schemabinding.version2.Feature;
36 * Class FeatureDescriptor.
38 * @version $Revision$ $Date$
40 public class FeatureDescriptor extends
41 org.exolab.castor.xml.util.XMLClassDescriptorImpl
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
49 * Field _elementDefinition.
51 private boolean _elementDefinition;
56 private java.lang.String _nsPrefix;
61 private java.lang.String _nsURI;
66 private java.lang.String _xmlName;
72 public FeatureDescriptor()
75 _nsURI = "www.jalview.org";
77 _elementDefinition = false;
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
87 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
88 java.lang.Integer.TYPE, "_begin", "begin",
89 org.exolab.castor.xml.NodeType.Attribute);
90 handler = new org.exolab.castor.xml.XMLFieldHandler()
92 public java.lang.Object getValue(java.lang.Object object)
93 throws IllegalStateException
95 Feature target = (Feature) object;
96 if (!target.hasBegin())
100 return new java.lang.Integer(target.getBegin());
103 public void setValue(java.lang.Object object, java.lang.Object value)
104 throws IllegalStateException, IllegalArgumentException
108 Feature target = (Feature) object;
109 // ignore null values for non optional primitives
115 target.setBegin(((java.lang.Integer) value).intValue());
116 } catch (java.lang.Exception ex)
118 throw new IllegalStateException(ex.toString());
122 public java.lang.Object newInstance(java.lang.Object parent)
127 desc.setHandler(handler);
128 desc.setRequired(true);
129 desc.setMultivalued(false);
130 addFieldDescriptor(desc);
132 // -- validation code for: _begin
133 fieldValidator = new org.exolab.castor.xml.FieldValidator();
134 fieldValidator.setMinOccurs(1);
136 org.exolab.castor.xml.validators.IntValidator typeValidator;
137 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
138 fieldValidator.setValidator(typeValidator);
139 typeValidator.setMinInclusive(-2147483648);
140 typeValidator.setMaxInclusive(2147483647);
142 desc.setValidator(fieldValidator);
144 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
145 java.lang.Integer.TYPE, "_end", "end",
146 org.exolab.castor.xml.NodeType.Attribute);
147 handler = new org.exolab.castor.xml.XMLFieldHandler()
149 public java.lang.Object getValue(java.lang.Object object)
150 throws IllegalStateException
152 Feature target = (Feature) object;
153 if (!target.hasEnd())
157 return new java.lang.Integer(target.getEnd());
160 public void setValue(java.lang.Object object, java.lang.Object value)
161 throws IllegalStateException, IllegalArgumentException
165 Feature target = (Feature) object;
166 // ignore null values for non optional primitives
172 target.setEnd(((java.lang.Integer) value).intValue());
173 } catch (java.lang.Exception ex)
175 throw new IllegalStateException(ex.toString());
179 public java.lang.Object newInstance(java.lang.Object parent)
184 desc.setHandler(handler);
185 desc.setRequired(true);
186 desc.setMultivalued(false);
187 addFieldDescriptor(desc);
189 // -- validation code for: _end
190 fieldValidator = new org.exolab.castor.xml.FieldValidator();
191 fieldValidator.setMinOccurs(1);
193 org.exolab.castor.xml.validators.IntValidator typeValidator;
194 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
195 fieldValidator.setValidator(typeValidator);
196 typeValidator.setMinInclusive(-2147483648);
197 typeValidator.setMaxInclusive(2147483647);
199 desc.setValidator(fieldValidator);
201 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
202 java.lang.String.class, "_type", "type",
203 org.exolab.castor.xml.NodeType.Attribute);
204 desc.setImmutable(true);
205 handler = new org.exolab.castor.xml.XMLFieldHandler()
207 public java.lang.Object getValue(java.lang.Object object)
208 throws IllegalStateException
210 Feature target = (Feature) object;
211 return target.getType();
214 public void setValue(java.lang.Object object, java.lang.Object value)
215 throws IllegalStateException, IllegalArgumentException
219 Feature target = (Feature) object;
220 target.setType((java.lang.String) value);
221 } catch (java.lang.Exception ex)
223 throw new IllegalStateException(ex.toString());
227 public java.lang.Object newInstance(java.lang.Object parent)
232 desc.setHandler(handler);
233 desc.setRequired(true);
234 desc.setMultivalued(false);
235 addFieldDescriptor(desc);
237 // -- validation code for: _type
238 fieldValidator = new org.exolab.castor.xml.FieldValidator();
239 fieldValidator.setMinOccurs(1);
241 org.exolab.castor.xml.validators.StringValidator typeValidator;
242 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
243 fieldValidator.setValidator(typeValidator);
244 typeValidator.setWhiteSpace("preserve");
246 desc.setValidator(fieldValidator);
248 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
249 java.lang.String.class, "_description", "description",
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 Feature target = (Feature) object;
258 return target.getDescription();
261 public void setValue(java.lang.Object object, java.lang.Object value)
262 throws IllegalStateException, IllegalArgumentException
266 Feature target = (Feature) object;
267 target.setDescription((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.setMultivalued(false);
281 addFieldDescriptor(desc);
283 // -- validation code for: _description
284 fieldValidator = new org.exolab.castor.xml.FieldValidator();
286 org.exolab.castor.xml.validators.StringValidator typeValidator;
287 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
288 fieldValidator.setValidator(typeValidator);
289 typeValidator.setWhiteSpace("preserve");
291 desc.setValidator(fieldValidator);
293 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
294 java.lang.String.class, "_status", "status",
295 org.exolab.castor.xml.NodeType.Attribute);
296 desc.setImmutable(true);
297 handler = new org.exolab.castor.xml.XMLFieldHandler()
299 public java.lang.Object getValue(java.lang.Object object)
300 throws IllegalStateException
302 Feature target = (Feature) object;
303 return target.getStatus();
306 public void setValue(java.lang.Object object, java.lang.Object value)
307 throws IllegalStateException, IllegalArgumentException
311 Feature target = (Feature) object;
312 target.setStatus((java.lang.String) value);
313 } catch (java.lang.Exception ex)
315 throw new IllegalStateException(ex.toString());
319 public java.lang.Object newInstance(java.lang.Object parent)
324 desc.setHandler(handler);
325 desc.setMultivalued(false);
326 addFieldDescriptor(desc);
328 // -- validation code for: _status
329 fieldValidator = new org.exolab.castor.xml.FieldValidator();
331 org.exolab.castor.xml.validators.StringValidator typeValidator;
332 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
333 fieldValidator.setValidator(typeValidator);
334 typeValidator.setWhiteSpace("preserve");
336 desc.setValidator(fieldValidator);
338 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
339 java.lang.String.class, "_featureGroup", "featureGroup",
340 org.exolab.castor.xml.NodeType.Attribute);
341 desc.setImmutable(true);
342 handler = new org.exolab.castor.xml.XMLFieldHandler()
344 public java.lang.Object getValue(java.lang.Object object)
345 throws IllegalStateException
347 Feature target = (Feature) object;
348 return target.getFeatureGroup();
351 public void setValue(java.lang.Object object, java.lang.Object value)
352 throws IllegalStateException, IllegalArgumentException
356 Feature target = (Feature) object;
357 target.setFeatureGroup((java.lang.String) value);
358 } catch (java.lang.Exception ex)
360 throw new IllegalStateException(ex.toString());
364 public java.lang.Object newInstance(java.lang.Object parent)
369 desc.setHandler(handler);
370 desc.setMultivalued(false);
371 addFieldDescriptor(desc);
373 // -- validation code for: _featureGroup
374 fieldValidator = new org.exolab.castor.xml.FieldValidator();
376 org.exolab.castor.xml.validators.StringValidator typeValidator;
377 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
378 fieldValidator.setValidator(typeValidator);
379 typeValidator.setWhiteSpace("preserve");
381 desc.setValidator(fieldValidator);
383 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
384 java.lang.Float.TYPE, "_score", "score",
385 org.exolab.castor.xml.NodeType.Attribute);
386 handler = new org.exolab.castor.xml.XMLFieldHandler()
388 public java.lang.Object getValue(java.lang.Object object)
389 throws IllegalStateException
391 Feature target = (Feature) object;
392 if (!target.hasScore())
396 return new java.lang.Float(target.getScore());
399 public void setValue(java.lang.Object object, java.lang.Object value)
400 throws IllegalStateException, IllegalArgumentException
404 Feature target = (Feature) object;
405 // if null, use delete method for optional primitives
408 target.deleteScore();
411 target.setScore(((java.lang.Float) value).floatValue());
412 } catch (java.lang.Exception ex)
414 throw new IllegalStateException(ex.toString());
418 public java.lang.Object newInstance(java.lang.Object parent)
423 desc.setHandler(handler);
424 desc.setMultivalued(false);
425 addFieldDescriptor(desc);
427 // -- validation code for: _score
428 fieldValidator = new org.exolab.castor.xml.FieldValidator();
430 org.exolab.castor.xml.validators.FloatValidator typeValidator;
431 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
432 fieldValidator.setValidator(typeValidator);
433 typeValidator.setMinInclusive((float) -3.4028235E38);
434 typeValidator.setMaxInclusive((float) 3.4028235E38);
436 desc.setValidator(fieldValidator);
437 // -- initialize element descriptors
440 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
441 jalview.schemabinding.version2.OtherData.class,
442 "_otherDataList", "otherData",
443 org.exolab.castor.xml.NodeType.Element);
444 handler = new org.exolab.castor.xml.XMLFieldHandler()
446 public java.lang.Object getValue(java.lang.Object object)
447 throws IllegalStateException
449 Feature target = (Feature) object;
450 return target.getOtherData();
453 public void setValue(java.lang.Object object, java.lang.Object value)
454 throws IllegalStateException, IllegalArgumentException
458 Feature target = (Feature) object;
459 target.addOtherData((jalview.schemabinding.version2.OtherData) value);
460 } catch (java.lang.Exception ex)
462 throw new IllegalStateException(ex.toString());
466 public void resetValue(Object object) throws IllegalStateException,
467 IllegalArgumentException
471 Feature target = (Feature) object;
472 target.removeAllOtherData();
473 } catch (java.lang.Exception ex)
475 throw new IllegalStateException(ex.toString());
479 public java.lang.Object newInstance(java.lang.Object parent)
481 return new jalview.schemabinding.version2.OtherData();
484 desc.setHandler(handler);
485 desc.setNameSpaceURI("www.jalview.org");
486 desc.setMultivalued(true);
487 addFieldDescriptor(desc);
489 // -- validation code for: _otherDataList
490 fieldValidator = new org.exolab.castor.xml.FieldValidator();
491 fieldValidator.setMinOccurs(0);
494 desc.setValidator(fieldValidator);
502 * Method getAccessMode.
504 * @return the access mode specified for this class.
506 public org.exolab.castor.mapping.AccessMode getAccessMode()
512 * Method getIdentity.
514 * @return the identity field, null if this class has no identity.
516 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
518 return super.getIdentity();
522 * Method getJavaClass.
524 * @return the Java class represented by this descriptor.
526 public java.lang.Class getJavaClass()
528 return jalview.schemabinding.version2.Feature.class;
532 * Method getNameSpacePrefix.
534 * @return the namespace prefix to use when marshaling as XML.
536 public java.lang.String getNameSpacePrefix()
542 * Method getNameSpaceURI.
544 * @return the namespace URI used when marshaling and unmarshaling as XML.
546 public java.lang.String getNameSpaceURI()
552 * Method getValidator.
554 * @return a specific validator for the class described by this
557 public org.exolab.castor.xml.TypeValidator getValidator()
565 * @return the XML Name for the Class being described.
567 public java.lang.String getXMLName()
573 * Method isElementDefinition.
575 * @return true if XML schema definition of this Class is that of a global
576 * element or element with anonymous type definition.
578 public boolean isElementDefinition()
580 return _elementDefinition;