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.Colour;
36 * Class ColourDescriptor.
38 * @version $Revision$ $Date$
40 public class ColourDescriptor 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 ColourDescriptor()
76 _elementDefinition = true;
77 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
78 org.exolab.castor.mapping.FieldHandler handler = null;
79 org.exolab.castor.xml.FieldValidator fieldValidator = null;
80 // -- initialize attribute descriptors
83 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
84 java.lang.String.class, "_name", "Name",
85 org.exolab.castor.xml.NodeType.Attribute);
86 desc.setImmutable(true);
87 handler = new org.exolab.castor.xml.XMLFieldHandler()
89 public java.lang.Object getValue(java.lang.Object object)
90 throws IllegalStateException
92 Colour target = (Colour) object;
93 return target.getName();
96 public void setValue(java.lang.Object object, java.lang.Object value)
97 throws IllegalStateException, IllegalArgumentException
101 Colour target = (Colour) object;
102 target.setName((java.lang.String) value);
103 } catch (java.lang.Exception ex)
105 throw new IllegalStateException(ex.toString());
109 public java.lang.Object newInstance(java.lang.Object parent)
114 desc.setHandler(handler);
115 desc.setMultivalued(false);
116 addFieldDescriptor(desc);
118 // -- validation code for: _name
119 fieldValidator = new org.exolab.castor.xml.FieldValidator();
121 org.exolab.castor.xml.validators.StringValidator typeValidator;
122 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
123 fieldValidator.setValidator(typeValidator);
124 typeValidator.setWhiteSpace("preserve");
126 desc.setValidator(fieldValidator);
128 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
129 java.lang.String.class, "_RGB", "RGB",
130 org.exolab.castor.xml.NodeType.Attribute);
131 desc.setImmutable(true);
132 handler = new org.exolab.castor.xml.XMLFieldHandler()
134 public java.lang.Object getValue(java.lang.Object object)
135 throws IllegalStateException
137 Colour target = (Colour) object;
138 return target.getRGB();
141 public void setValue(java.lang.Object object, java.lang.Object value)
142 throws IllegalStateException, IllegalArgumentException
146 Colour target = (Colour) object;
147 target.setRGB((java.lang.String) value);
148 } catch (java.lang.Exception ex)
150 throw new IllegalStateException(ex.toString());
154 public java.lang.Object newInstance(java.lang.Object parent)
159 desc.setHandler(handler);
160 desc.setRequired(true);
161 desc.setMultivalued(false);
162 addFieldDescriptor(desc);
164 // -- validation code for: _RGB
165 fieldValidator = new org.exolab.castor.xml.FieldValidator();
166 fieldValidator.setMinOccurs(1);
168 org.exolab.castor.xml.validators.StringValidator typeValidator;
169 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
170 fieldValidator.setValidator(typeValidator);
171 typeValidator.setWhiteSpace("preserve");
173 desc.setValidator(fieldValidator);
175 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
176 java.lang.String.class, "_minRGB", "minRGB",
177 org.exolab.castor.xml.NodeType.Attribute);
178 desc.setImmutable(true);
179 handler = new org.exolab.castor.xml.XMLFieldHandler()
181 public java.lang.Object getValue(java.lang.Object object)
182 throws IllegalStateException
184 Colour target = (Colour) object;
185 return target.getMinRGB();
188 public void setValue(java.lang.Object object, java.lang.Object value)
189 throws IllegalStateException, IllegalArgumentException
193 Colour target = (Colour) object;
194 target.setMinRGB((java.lang.String) value);
195 } catch (java.lang.Exception ex)
197 throw new IllegalStateException(ex.toString());
201 public java.lang.Object newInstance(java.lang.Object parent)
206 desc.setHandler(handler);
207 desc.setMultivalued(false);
208 addFieldDescriptor(desc);
210 // -- validation code for: _minRGB
211 fieldValidator = new org.exolab.castor.xml.FieldValidator();
213 org.exolab.castor.xml.validators.StringValidator typeValidator;
214 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
215 fieldValidator.setValidator(typeValidator);
216 typeValidator.setWhiteSpace("preserve");
218 desc.setValidator(fieldValidator);
220 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
221 java.lang.String.class, "_threshType", "threshType",
222 org.exolab.castor.xml.NodeType.Attribute);
223 desc.setImmutable(true);
224 handler = new org.exolab.castor.xml.XMLFieldHandler()
226 public java.lang.Object getValue(java.lang.Object object)
227 throws IllegalStateException
229 Colour target = (Colour) object;
230 return target.getThreshType();
233 public void setValue(java.lang.Object object, java.lang.Object value)
234 throws IllegalStateException, IllegalArgumentException
238 Colour target = (Colour) object;
239 target.setThreshType((java.lang.String) value);
240 } catch (java.lang.Exception ex)
242 throw new IllegalStateException(ex.toString());
246 public java.lang.Object newInstance(java.lang.Object parent)
251 desc.setHandler(handler);
252 desc.setMultivalued(false);
253 addFieldDescriptor(desc);
255 // -- validation code for: _threshType
256 fieldValidator = new org.exolab.castor.xml.FieldValidator();
258 org.exolab.castor.xml.validators.StringValidator typeValidator;
259 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
260 fieldValidator.setValidator(typeValidator);
261 typeValidator.setWhiteSpace("preserve");
263 desc.setValidator(fieldValidator);
265 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
266 java.lang.Float.TYPE, "_threshold", "threshold",
267 org.exolab.castor.xml.NodeType.Attribute);
268 handler = new org.exolab.castor.xml.XMLFieldHandler()
270 public java.lang.Object getValue(java.lang.Object object)
271 throws IllegalStateException
273 Colour target = (Colour) object;
274 if (!target.hasThreshold())
278 return new java.lang.Float(target.getThreshold());
281 public void setValue(java.lang.Object object, java.lang.Object value)
282 throws IllegalStateException, IllegalArgumentException
286 Colour target = (Colour) object;
287 // if null, use delete method for optional primitives
290 target.deleteThreshold();
293 target.setThreshold(((java.lang.Float) value).floatValue());
294 } catch (java.lang.Exception ex)
296 throw new IllegalStateException(ex.toString());
300 public java.lang.Object newInstance(java.lang.Object parent)
305 desc.setHandler(handler);
306 desc.setMultivalued(false);
307 addFieldDescriptor(desc);
309 // -- validation code for: _threshold
310 fieldValidator = new org.exolab.castor.xml.FieldValidator();
312 org.exolab.castor.xml.validators.FloatValidator typeValidator;
313 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
314 fieldValidator.setValidator(typeValidator);
315 typeValidator.setMinInclusive((float) -3.4028235E38);
316 typeValidator.setMaxInclusive((float) 3.4028235E38);
318 desc.setValidator(fieldValidator);
320 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
321 java.lang.Float.TYPE, "_max", "max",
322 org.exolab.castor.xml.NodeType.Attribute);
323 handler = new org.exolab.castor.xml.XMLFieldHandler()
325 public java.lang.Object getValue(java.lang.Object object)
326 throws IllegalStateException
328 Colour target = (Colour) object;
329 if (!target.hasMax())
333 return new java.lang.Float(target.getMax());
336 public void setValue(java.lang.Object object, java.lang.Object value)
337 throws IllegalStateException, IllegalArgumentException
341 Colour target = (Colour) object;
342 // if null, use delete method for optional primitives
348 target.setMax(((java.lang.Float) value).floatValue());
349 } catch (java.lang.Exception ex)
351 throw new IllegalStateException(ex.toString());
355 public java.lang.Object newInstance(java.lang.Object parent)
360 desc.setHandler(handler);
361 desc.setMultivalued(false);
362 addFieldDescriptor(desc);
364 // -- validation code for: _max
365 fieldValidator = new org.exolab.castor.xml.FieldValidator();
367 org.exolab.castor.xml.validators.FloatValidator typeValidator;
368 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
369 fieldValidator.setValidator(typeValidator);
370 typeValidator.setMinInclusive((float) -3.4028235E38);
371 typeValidator.setMaxInclusive((float) 3.4028235E38);
373 desc.setValidator(fieldValidator);
375 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
376 java.lang.Float.TYPE, "_min", "min",
377 org.exolab.castor.xml.NodeType.Attribute);
378 handler = new org.exolab.castor.xml.XMLFieldHandler()
380 public java.lang.Object getValue(java.lang.Object object)
381 throws IllegalStateException
383 Colour target = (Colour) object;
384 if (!target.hasMin())
388 return new java.lang.Float(target.getMin());
391 public void setValue(java.lang.Object object, java.lang.Object value)
392 throws IllegalStateException, IllegalArgumentException
396 Colour target = (Colour) object;
397 // if null, use delete method for optional primitives
403 target.setMin(((java.lang.Float) value).floatValue());
404 } catch (java.lang.Exception ex)
406 throw new IllegalStateException(ex.toString());
410 public java.lang.Object newInstance(java.lang.Object parent)
415 desc.setHandler(handler);
416 desc.setMultivalued(false);
417 addFieldDescriptor(desc);
419 // -- validation code for: _min
420 fieldValidator = new org.exolab.castor.xml.FieldValidator();
422 org.exolab.castor.xml.validators.FloatValidator typeValidator;
423 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
424 fieldValidator.setValidator(typeValidator);
425 typeValidator.setMinInclusive((float) -3.4028235E38);
426 typeValidator.setMaxInclusive((float) 3.4028235E38);
428 desc.setValidator(fieldValidator);
430 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
431 java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
432 org.exolab.castor.xml.NodeType.Attribute);
433 handler = new org.exolab.castor.xml.XMLFieldHandler()
435 public java.lang.Object getValue(java.lang.Object object)
436 throws IllegalStateException
438 Colour target = (Colour) object;
439 if (!target.hasColourByLabel())
443 return (target.getColourByLabel() ? java.lang.Boolean.TRUE
444 : java.lang.Boolean.FALSE);
447 public void setValue(java.lang.Object object, java.lang.Object value)
448 throws IllegalStateException, IllegalArgumentException
452 Colour target = (Colour) object;
453 // if null, use delete method for optional primitives
456 target.deleteColourByLabel();
459 target.setColourByLabel(((java.lang.Boolean) value)
461 } catch (java.lang.Exception ex)
463 throw new IllegalStateException(ex.toString());
467 public java.lang.Object newInstance(java.lang.Object parent)
472 desc.setHandler(handler);
473 desc.setMultivalued(false);
474 addFieldDescriptor(desc);
476 // -- validation code for: _colourByLabel
477 fieldValidator = new org.exolab.castor.xml.FieldValidator();
479 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
480 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
481 fieldValidator.setValidator(typeValidator);
483 desc.setValidator(fieldValidator);
485 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
486 java.lang.Boolean.TYPE, "_autoScale", "autoScale",
487 org.exolab.castor.xml.NodeType.Attribute);
488 handler = new org.exolab.castor.xml.XMLFieldHandler()
490 public java.lang.Object getValue(java.lang.Object object)
491 throws IllegalStateException
493 Colour target = (Colour) object;
494 if (!target.hasAutoScale())
498 return (target.getAutoScale() ? java.lang.Boolean.TRUE
499 : java.lang.Boolean.FALSE);
502 public void setValue(java.lang.Object object, java.lang.Object value)
503 throws IllegalStateException, IllegalArgumentException
507 Colour target = (Colour) object;
508 // if null, use delete method for optional primitives
511 target.deleteAutoScale();
514 target.setAutoScale(((java.lang.Boolean) value).booleanValue());
515 } catch (java.lang.Exception ex)
517 throw new IllegalStateException(ex.toString());
521 public java.lang.Object newInstance(java.lang.Object parent)
526 desc.setHandler(handler);
527 desc.setMultivalued(false);
528 addFieldDescriptor(desc);
530 // -- validation code for: _autoScale
531 fieldValidator = new org.exolab.castor.xml.FieldValidator();
533 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
534 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
535 fieldValidator.setValidator(typeValidator);
537 desc.setValidator(fieldValidator);
538 // -- initialize element descriptors
547 * Method getAccessMode.
549 * @return the access mode specified for this class.
551 public org.exolab.castor.mapping.AccessMode getAccessMode()
557 * Method getIdentity.
559 * @return the identity field, null if this class has no identity.
561 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
563 return super.getIdentity();
567 * Method getJavaClass.
569 * @return the Java class represented by this descriptor.
571 public java.lang.Class getJavaClass()
573 return jalview.schemabinding.version2.Colour.class;
577 * Method getNameSpacePrefix.
579 * @return the namespace prefix to use when marshaling as XML.
581 public java.lang.String getNameSpacePrefix()
587 * Method getNameSpaceURI.
589 * @return the namespace URI used when marshaling and unmarshaling as XML.
591 public java.lang.String getNameSpaceURI()
597 * Method getValidator.
599 * @return a specific validator for the class described by this
602 public org.exolab.castor.xml.TypeValidator getValidator()
610 * @return the XML Name for the Class being described.
612 public java.lang.String getXMLName()
618 * Method isElementDefinition.
620 * @return true if XML schema definition of this Class is that of a global
621 * element or element with anonymous type definition.
623 public boolean isElementDefinition()
625 return _elementDefinition;