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.Setting;
36 * Class SettingDescriptor.
38 * @version $Revision$ $Date$
40 public class SettingDescriptor 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 SettingDescriptor()
75 _nsURI = "www.jalview.org";
77 _elementDefinition = true;
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(
85 java.lang.String.class, "_type", "type",
86 org.exolab.castor.xml.NodeType.Attribute);
87 desc.setImmutable(true);
88 handler = new org.exolab.castor.xml.XMLFieldHandler()
90 public java.lang.Object getValue(java.lang.Object object)
91 throws IllegalStateException
93 Setting target = (Setting) object;
94 return target.getType();
97 public void setValue(java.lang.Object object, java.lang.Object value)
98 throws IllegalStateException, IllegalArgumentException
102 Setting target = (Setting) object;
103 target.setType((java.lang.String) value);
104 } catch (java.lang.Exception ex)
106 throw new IllegalStateException(ex.toString());
110 public java.lang.Object newInstance(java.lang.Object parent)
115 desc.setHandler(handler);
116 desc.setRequired(true);
117 desc.setMultivalued(false);
118 addFieldDescriptor(desc);
120 // -- validation code for: _type
121 fieldValidator = new org.exolab.castor.xml.FieldValidator();
122 fieldValidator.setMinOccurs(1);
124 org.exolab.castor.xml.validators.StringValidator typeValidator;
125 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
126 fieldValidator.setValidator(typeValidator);
127 typeValidator.setWhiteSpace("preserve");
129 desc.setValidator(fieldValidator);
131 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
132 java.lang.Integer.TYPE, "_colour", "colour",
133 org.exolab.castor.xml.NodeType.Attribute);
134 handler = new org.exolab.castor.xml.XMLFieldHandler()
136 public java.lang.Object getValue(java.lang.Object object)
137 throws IllegalStateException
139 Setting target = (Setting) object;
140 if (!target.hasColour())
144 return new java.lang.Integer(target.getColour());
147 public void setValue(java.lang.Object object, java.lang.Object value)
148 throws IllegalStateException, IllegalArgumentException
152 Setting target = (Setting) object;
153 // ignore null values for non optional primitives
159 target.setColour(((java.lang.Integer) value).intValue());
160 } catch (java.lang.Exception ex)
162 throw new IllegalStateException(ex.toString());
166 public java.lang.Object newInstance(java.lang.Object parent)
171 desc.setHandler(handler);
172 desc.setRequired(true);
173 desc.setMultivalued(false);
174 addFieldDescriptor(desc);
176 // -- validation code for: _colour
177 fieldValidator = new org.exolab.castor.xml.FieldValidator();
178 fieldValidator.setMinOccurs(1);
180 org.exolab.castor.xml.validators.IntValidator typeValidator;
181 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
182 fieldValidator.setValidator(typeValidator);
183 typeValidator.setMinInclusive(-2147483648);
184 typeValidator.setMaxInclusive(2147483647);
186 desc.setValidator(fieldValidator);
188 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
189 java.lang.Boolean.TYPE, "_display", "display",
190 org.exolab.castor.xml.NodeType.Attribute);
191 handler = new org.exolab.castor.xml.XMLFieldHandler()
193 public java.lang.Object getValue(java.lang.Object object)
194 throws IllegalStateException
196 Setting target = (Setting) object;
197 if (!target.hasDisplay())
201 return (target.getDisplay() ? java.lang.Boolean.TRUE
202 : java.lang.Boolean.FALSE);
205 public void setValue(java.lang.Object object, java.lang.Object value)
206 throws IllegalStateException, IllegalArgumentException
210 Setting target = (Setting) object;
211 // ignore null values for non optional primitives
217 target.setDisplay(((java.lang.Boolean) value).booleanValue());
218 } catch (java.lang.Exception ex)
220 throw new IllegalStateException(ex.toString());
224 public java.lang.Object newInstance(java.lang.Object parent)
229 desc.setHandler(handler);
230 desc.setRequired(true);
231 desc.setMultivalued(false);
232 addFieldDescriptor(desc);
234 // -- validation code for: _display
235 fieldValidator = new org.exolab.castor.xml.FieldValidator();
236 fieldValidator.setMinOccurs(1);
238 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
239 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
240 fieldValidator.setValidator(typeValidator);
242 desc.setValidator(fieldValidator);
244 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
245 java.lang.Float.TYPE, "_order", "order",
246 org.exolab.castor.xml.NodeType.Attribute);
247 handler = new org.exolab.castor.xml.XMLFieldHandler()
249 public java.lang.Object getValue(java.lang.Object object)
250 throws IllegalStateException
252 Setting target = (Setting) object;
253 if (!target.hasOrder())
257 return new java.lang.Float(target.getOrder());
260 public void setValue(java.lang.Object object, java.lang.Object value)
261 throws IllegalStateException, IllegalArgumentException
265 Setting target = (Setting) object;
266 // if null, use delete method for optional primitives
269 target.deleteOrder();
272 target.setOrder(((java.lang.Float) value).floatValue());
273 } catch (java.lang.Exception ex)
275 throw new IllegalStateException(ex.toString());
279 public java.lang.Object newInstance(java.lang.Object parent)
284 desc.setHandler(handler);
285 desc.setMultivalued(false);
286 addFieldDescriptor(desc);
288 // -- validation code for: _order
289 fieldValidator = new org.exolab.castor.xml.FieldValidator();
291 org.exolab.castor.xml.validators.FloatValidator typeValidator;
292 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
293 fieldValidator.setValidator(typeValidator);
294 typeValidator.setMinInclusive((float) -3.4028235E38);
295 typeValidator.setMaxInclusive((float) 3.4028235E38);
297 desc.setValidator(fieldValidator);
299 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
300 java.lang.Integer.TYPE, "_mincolour", "mincolour",
301 org.exolab.castor.xml.NodeType.Attribute);
302 handler = new org.exolab.castor.xml.XMLFieldHandler()
304 public java.lang.Object getValue(java.lang.Object object)
305 throws IllegalStateException
307 Setting target = (Setting) object;
308 if (!target.hasMincolour())
312 return new java.lang.Integer(target.getMincolour());
315 public void setValue(java.lang.Object object, java.lang.Object value)
316 throws IllegalStateException, IllegalArgumentException
320 Setting target = (Setting) object;
321 // if null, use delete method for optional primitives
324 target.deleteMincolour();
327 target.setMincolour(((java.lang.Integer) value).intValue());
328 } catch (java.lang.Exception ex)
330 throw new IllegalStateException(ex.toString());
334 public java.lang.Object newInstance(java.lang.Object parent)
339 desc.setHandler(handler);
340 desc.setMultivalued(false);
341 addFieldDescriptor(desc);
343 // -- validation code for: _mincolour
344 fieldValidator = new org.exolab.castor.xml.FieldValidator();
346 org.exolab.castor.xml.validators.IntValidator typeValidator;
347 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
348 fieldValidator.setValidator(typeValidator);
349 typeValidator.setMinInclusive(-2147483648);
350 typeValidator.setMaxInclusive(2147483647);
352 desc.setValidator(fieldValidator);
354 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
355 java.lang.Float.TYPE, "_threshold", "threshold",
356 org.exolab.castor.xml.NodeType.Attribute);
357 handler = new org.exolab.castor.xml.XMLFieldHandler()
359 public java.lang.Object getValue(java.lang.Object object)
360 throws IllegalStateException
362 Setting target = (Setting) object;
363 if (!target.hasThreshold())
367 return new java.lang.Float(target.getThreshold());
370 public void setValue(java.lang.Object object, java.lang.Object value)
371 throws IllegalStateException, IllegalArgumentException
375 Setting target = (Setting) object;
376 // if null, use delete method for optional primitives
379 target.deleteThreshold();
382 target.setThreshold(((java.lang.Float) value).floatValue());
383 } catch (java.lang.Exception ex)
385 throw new IllegalStateException(ex.toString());
389 public java.lang.Object newInstance(java.lang.Object parent)
394 desc.setHandler(handler);
395 desc.setMultivalued(false);
396 addFieldDescriptor(desc);
398 // -- validation code for: _threshold
399 fieldValidator = new org.exolab.castor.xml.FieldValidator();
401 org.exolab.castor.xml.validators.FloatValidator typeValidator;
402 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
403 fieldValidator.setValidator(typeValidator);
404 typeValidator.setMinInclusive((float) -3.4028235E38);
405 typeValidator.setMaxInclusive((float) 3.4028235E38);
407 desc.setValidator(fieldValidator);
409 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
410 java.lang.Integer.TYPE, "_threshstate", "threshstate",
411 org.exolab.castor.xml.NodeType.Attribute);
412 handler = new org.exolab.castor.xml.XMLFieldHandler()
414 public java.lang.Object getValue(java.lang.Object object)
415 throws IllegalStateException
417 Setting target = (Setting) object;
418 if (!target.hasThreshstate())
422 return new java.lang.Integer(target.getThreshstate());
425 public void setValue(java.lang.Object object, java.lang.Object value)
426 throws IllegalStateException, IllegalArgumentException
430 Setting target = (Setting) object;
431 // if null, use delete method for optional primitives
434 target.deleteThreshstate();
437 target.setThreshstate(((java.lang.Integer) value).intValue());
438 } catch (java.lang.Exception ex)
440 throw new IllegalStateException(ex.toString());
444 public java.lang.Object newInstance(java.lang.Object parent)
449 desc.setHandler(handler);
450 desc.setMultivalued(false);
451 addFieldDescriptor(desc);
453 // -- validation code for: _threshstate
454 fieldValidator = new org.exolab.castor.xml.FieldValidator();
456 org.exolab.castor.xml.validators.IntValidator typeValidator;
457 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
458 fieldValidator.setValidator(typeValidator);
459 typeValidator.setMinInclusive(-2147483648);
460 typeValidator.setMaxInclusive(2147483647);
462 desc.setValidator(fieldValidator);
464 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
465 java.lang.Float.TYPE, "_max", "max",
466 org.exolab.castor.xml.NodeType.Attribute);
467 handler = new org.exolab.castor.xml.XMLFieldHandler()
469 public java.lang.Object getValue(java.lang.Object object)
470 throws IllegalStateException
472 Setting target = (Setting) object;
473 if (!target.hasMax())
477 return new java.lang.Float(target.getMax());
480 public void setValue(java.lang.Object object, java.lang.Object value)
481 throws IllegalStateException, IllegalArgumentException
485 Setting target = (Setting) object;
486 // if null, use delete method for optional primitives
492 target.setMax(((java.lang.Float) value).floatValue());
493 } catch (java.lang.Exception ex)
495 throw new IllegalStateException(ex.toString());
499 public java.lang.Object newInstance(java.lang.Object parent)
504 desc.setHandler(handler);
505 desc.setMultivalued(false);
506 addFieldDescriptor(desc);
508 // -- validation code for: _max
509 fieldValidator = new org.exolab.castor.xml.FieldValidator();
511 org.exolab.castor.xml.validators.FloatValidator typeValidator;
512 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
513 fieldValidator.setValidator(typeValidator);
514 typeValidator.setMinInclusive((float) -3.4028235E38);
515 typeValidator.setMaxInclusive((float) 3.4028235E38);
517 desc.setValidator(fieldValidator);
519 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
520 java.lang.Float.TYPE, "_min", "min",
521 org.exolab.castor.xml.NodeType.Attribute);
522 handler = new org.exolab.castor.xml.XMLFieldHandler()
524 public java.lang.Object getValue(java.lang.Object object)
525 throws IllegalStateException
527 Setting target = (Setting) object;
528 if (!target.hasMin())
532 return new java.lang.Float(target.getMin());
535 public void setValue(java.lang.Object object, java.lang.Object value)
536 throws IllegalStateException, IllegalArgumentException
540 Setting target = (Setting) object;
541 // if null, use delete method for optional primitives
547 target.setMin(((java.lang.Float) value).floatValue());
548 } catch (java.lang.Exception ex)
550 throw new IllegalStateException(ex.toString());
554 public java.lang.Object newInstance(java.lang.Object parent)
559 desc.setHandler(handler);
560 desc.setMultivalued(false);
561 addFieldDescriptor(desc);
563 // -- validation code for: _min
564 fieldValidator = new org.exolab.castor.xml.FieldValidator();
566 org.exolab.castor.xml.validators.FloatValidator typeValidator;
567 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
568 fieldValidator.setValidator(typeValidator);
569 typeValidator.setMinInclusive((float) -3.4028235E38);
570 typeValidator.setMaxInclusive((float) 3.4028235E38);
572 desc.setValidator(fieldValidator);
574 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
575 java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
576 org.exolab.castor.xml.NodeType.Attribute);
577 handler = new org.exolab.castor.xml.XMLFieldHandler()
579 public java.lang.Object getValue(java.lang.Object object)
580 throws IllegalStateException
582 Setting target = (Setting) object;
583 if (!target.hasColourByLabel())
587 return (target.getColourByLabel() ? java.lang.Boolean.TRUE
588 : java.lang.Boolean.FALSE);
591 public void setValue(java.lang.Object object, java.lang.Object value)
592 throws IllegalStateException, IllegalArgumentException
596 Setting target = (Setting) object;
597 // if null, use delete method for optional primitives
600 target.deleteColourByLabel();
603 target.setColourByLabel(((java.lang.Boolean) value)
605 } catch (java.lang.Exception ex)
607 throw new IllegalStateException(ex.toString());
611 public java.lang.Object newInstance(java.lang.Object parent)
616 desc.setHandler(handler);
617 desc.setMultivalued(false);
618 addFieldDescriptor(desc);
620 // -- validation code for: _colourByLabel
621 fieldValidator = new org.exolab.castor.xml.FieldValidator();
623 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
624 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
625 fieldValidator.setValidator(typeValidator);
627 desc.setValidator(fieldValidator);
629 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
630 java.lang.Boolean.TYPE, "_autoScale", "autoScale",
631 org.exolab.castor.xml.NodeType.Attribute);
632 handler = new org.exolab.castor.xml.XMLFieldHandler()
634 public java.lang.Object getValue(java.lang.Object object)
635 throws IllegalStateException
637 Setting target = (Setting) object;
638 if (!target.hasAutoScale())
642 return (target.getAutoScale() ? java.lang.Boolean.TRUE
643 : java.lang.Boolean.FALSE);
646 public void setValue(java.lang.Object object, java.lang.Object value)
647 throws IllegalStateException, IllegalArgumentException
651 Setting target = (Setting) object;
652 // if null, use delete method for optional primitives
655 target.deleteAutoScale();
658 target.setAutoScale(((java.lang.Boolean) value).booleanValue());
659 } catch (java.lang.Exception ex)
661 throw new IllegalStateException(ex.toString());
665 public java.lang.Object newInstance(java.lang.Object parent)
670 desc.setHandler(handler);
671 desc.setMultivalued(false);
672 addFieldDescriptor(desc);
674 // -- validation code for: _autoScale
675 fieldValidator = new org.exolab.castor.xml.FieldValidator();
677 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
678 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
679 fieldValidator.setValidator(typeValidator);
681 desc.setValidator(fieldValidator);
682 // -- initialize element descriptors
691 * Method getAccessMode.
693 * @return the access mode specified for this class.
695 public org.exolab.castor.mapping.AccessMode getAccessMode()
701 * Method getIdentity.
703 * @return the identity field, null if this class has no identity.
705 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
707 return super.getIdentity();
711 * Method getJavaClass.
713 * @return the Java class represented by this descriptor.
715 public java.lang.Class getJavaClass()
717 return jalview.schemabinding.version2.Setting.class;
721 * Method getNameSpacePrefix.
723 * @return the namespace prefix to use when marshaling as XML.
725 public java.lang.String getNameSpacePrefix()
731 * Method getNameSpaceURI.
733 * @return the namespace URI used when marshaling and unmarshaling as XML.
735 public java.lang.String getNameSpaceURI()
741 * Method getValidator.
743 * @return a specific validator for the class described by this
746 public org.exolab.castor.xml.TypeValidator getValidator()
754 * @return the XML Name for the Class being described.
756 public java.lang.String getXMLName()
762 * Method isElementDefinition.
764 * @return true if XML schema definition of this Class is that of a global
765 * element or element with anonymous type definition.
767 public boolean isElementDefinition()
769 return _elementDefinition;