1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.Colour;
34 * Class ColourDescriptor.
36 * @version $Revision$ $Date$
38 public class ColourDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41 //--------------------------/
42 //- Class/Member Variables -/
43 //--------------------------/
46 * Field _elementDefinition.
48 private boolean _elementDefinition;
53 private java.lang.String _nsPrefix;
58 private java.lang.String _nsURI;
63 private java.lang.String _xmlName;
70 public ColourDescriptor() {
73 _elementDefinition = true;
74 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
75 org.exolab.castor.mapping.FieldHandler handler = null;
76 org.exolab.castor.xml.FieldValidator fieldValidator = null;
77 //-- initialize attribute descriptors
80 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "Name", org.exolab.castor.xml.NodeType.Attribute);
81 desc.setImmutable(true);
82 handler = new org.exolab.castor.xml.XMLFieldHandler() {
83 public java.lang.Object getValue( java.lang.Object object )
84 throws IllegalStateException
86 Colour target = (Colour) object;
87 return target.getName();
89 public void setValue( java.lang.Object object, java.lang.Object value)
90 throws IllegalStateException, IllegalArgumentException
93 Colour target = (Colour) object;
94 target.setName( (java.lang.String) value);
95 } catch (java.lang.Exception ex) {
96 throw new IllegalStateException(ex.toString());
99 public java.lang.Object newInstance(java.lang.Object parent) {
103 desc.setHandler(handler);
104 desc.setMultivalued(false);
105 addFieldDescriptor(desc);
107 //-- validation code for: _name
108 fieldValidator = new org.exolab.castor.xml.FieldValidator();
110 org.exolab.castor.xml.validators.StringValidator typeValidator;
111 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
112 fieldValidator.setValidator(typeValidator);
113 typeValidator.setWhiteSpace("preserve");
115 desc.setValidator(fieldValidator);
117 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_RGB", "RGB", org.exolab.castor.xml.NodeType.Attribute);
118 desc.setImmutable(true);
119 handler = new org.exolab.castor.xml.XMLFieldHandler() {
120 public java.lang.Object getValue( java.lang.Object object )
121 throws IllegalStateException
123 Colour target = (Colour) object;
124 return target.getRGB();
126 public void setValue( java.lang.Object object, java.lang.Object value)
127 throws IllegalStateException, IllegalArgumentException
130 Colour target = (Colour) object;
131 target.setRGB( (java.lang.String) value);
132 } catch (java.lang.Exception ex) {
133 throw new IllegalStateException(ex.toString());
136 public java.lang.Object newInstance(java.lang.Object parent) {
140 desc.setHandler(handler);
141 desc.setRequired(true);
142 desc.setMultivalued(false);
143 addFieldDescriptor(desc);
145 //-- validation code for: _RGB
146 fieldValidator = new org.exolab.castor.xml.FieldValidator();
147 fieldValidator.setMinOccurs(1);
149 org.exolab.castor.xml.validators.StringValidator typeValidator;
150 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
151 fieldValidator.setValidator(typeValidator);
152 typeValidator.setWhiteSpace("preserve");
154 desc.setValidator(fieldValidator);
156 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_minRGB", "minRGB", org.exolab.castor.xml.NodeType.Attribute);
157 desc.setImmutable(true);
158 handler = new org.exolab.castor.xml.XMLFieldHandler() {
159 public java.lang.Object getValue( java.lang.Object object )
160 throws IllegalStateException
162 Colour target = (Colour) object;
163 return target.getMinRGB();
165 public void setValue( java.lang.Object object, java.lang.Object value)
166 throws IllegalStateException, IllegalArgumentException
169 Colour target = (Colour) object;
170 target.setMinRGB( (java.lang.String) value);
171 } catch (java.lang.Exception ex) {
172 throw new IllegalStateException(ex.toString());
175 public java.lang.Object newInstance(java.lang.Object parent) {
179 desc.setHandler(handler);
180 desc.setMultivalued(false);
181 addFieldDescriptor(desc);
183 //-- validation code for: _minRGB
184 fieldValidator = new org.exolab.castor.xml.FieldValidator();
186 org.exolab.castor.xml.validators.StringValidator typeValidator;
187 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
188 fieldValidator.setValidator(typeValidator);
189 typeValidator.setWhiteSpace("preserve");
191 desc.setValidator(fieldValidator);
193 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_threshType", "threshType", org.exolab.castor.xml.NodeType.Attribute);
194 desc.setImmutable(true);
195 handler = new org.exolab.castor.xml.XMLFieldHandler() {
196 public java.lang.Object getValue( java.lang.Object object )
197 throws IllegalStateException
199 Colour target = (Colour) object;
200 return target.getThreshType();
202 public void setValue( java.lang.Object object, java.lang.Object value)
203 throws IllegalStateException, IllegalArgumentException
206 Colour target = (Colour) object;
207 target.setThreshType( (java.lang.String) value);
208 } catch (java.lang.Exception ex) {
209 throw new IllegalStateException(ex.toString());
212 public java.lang.Object newInstance(java.lang.Object parent) {
216 desc.setHandler(handler);
217 desc.setMultivalued(false);
218 addFieldDescriptor(desc);
220 //-- validation code for: _threshType
221 fieldValidator = new org.exolab.castor.xml.FieldValidator();
223 org.exolab.castor.xml.validators.StringValidator typeValidator;
224 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
225 fieldValidator.setValidator(typeValidator);
226 typeValidator.setWhiteSpace("preserve");
228 desc.setValidator(fieldValidator);
230 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
231 handler = new org.exolab.castor.xml.XMLFieldHandler() {
232 public java.lang.Object getValue( java.lang.Object object )
233 throws IllegalStateException
235 Colour target = (Colour) object;
236 if (!target.hasThreshold()) { return null; }
237 return new java.lang.Float(target.getThreshold());
239 public void setValue( java.lang.Object object, java.lang.Object value)
240 throws IllegalStateException, IllegalArgumentException
243 Colour target = (Colour) object;
244 // if null, use delete method for optional primitives
246 target.deleteThreshold();
249 target.setThreshold( ((java.lang.Float) value).floatValue());
250 } catch (java.lang.Exception ex) {
251 throw new IllegalStateException(ex.toString());
254 public java.lang.Object newInstance(java.lang.Object parent) {
258 desc.setHandler(handler);
259 desc.setMultivalued(false);
260 addFieldDescriptor(desc);
262 //-- validation code for: _threshold
263 fieldValidator = new org.exolab.castor.xml.FieldValidator();
265 org.exolab.castor.xml.validators.FloatValidator typeValidator;
266 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
267 fieldValidator.setValidator(typeValidator);
268 typeValidator.setMinInclusive((float) -3.4028235E38);
269 typeValidator.setMaxInclusive((float) 3.4028235E38);
271 desc.setValidator(fieldValidator);
273 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_max", "max", org.exolab.castor.xml.NodeType.Attribute);
274 handler = new org.exolab.castor.xml.XMLFieldHandler() {
275 public java.lang.Object getValue( java.lang.Object object )
276 throws IllegalStateException
278 Colour target = (Colour) object;
279 if (!target.hasMax()) { return null; }
280 return new java.lang.Float(target.getMax());
282 public void setValue( java.lang.Object object, java.lang.Object value)
283 throws IllegalStateException, IllegalArgumentException
286 Colour target = (Colour) object;
287 // if null, use delete method for optional primitives
292 target.setMax( ((java.lang.Float) value).floatValue());
293 } catch (java.lang.Exception ex) {
294 throw new IllegalStateException(ex.toString());
297 public java.lang.Object newInstance(java.lang.Object parent) {
301 desc.setHandler(handler);
302 desc.setMultivalued(false);
303 addFieldDescriptor(desc);
305 //-- validation code for: _max
306 fieldValidator = new org.exolab.castor.xml.FieldValidator();
308 org.exolab.castor.xml.validators.FloatValidator typeValidator;
309 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
310 fieldValidator.setValidator(typeValidator);
311 typeValidator.setMinInclusive((float) -3.4028235E38);
312 typeValidator.setMaxInclusive((float) 3.4028235E38);
314 desc.setValidator(fieldValidator);
316 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_min", "min", org.exolab.castor.xml.NodeType.Attribute);
317 handler = new org.exolab.castor.xml.XMLFieldHandler() {
318 public java.lang.Object getValue( java.lang.Object object )
319 throws IllegalStateException
321 Colour target = (Colour) object;
322 if (!target.hasMin()) { return null; }
323 return new java.lang.Float(target.getMin());
325 public void setValue( java.lang.Object object, java.lang.Object value)
326 throws IllegalStateException, IllegalArgumentException
329 Colour target = (Colour) object;
330 // if null, use delete method for optional primitives
335 target.setMin( ((java.lang.Float) value).floatValue());
336 } catch (java.lang.Exception ex) {
337 throw new IllegalStateException(ex.toString());
340 public java.lang.Object newInstance(java.lang.Object parent) {
344 desc.setHandler(handler);
345 desc.setMultivalued(false);
346 addFieldDescriptor(desc);
348 //-- validation code for: _min
349 fieldValidator = new org.exolab.castor.xml.FieldValidator();
351 org.exolab.castor.xml.validators.FloatValidator typeValidator;
352 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
353 fieldValidator.setValidator(typeValidator);
354 typeValidator.setMinInclusive((float) -3.4028235E38);
355 typeValidator.setMaxInclusive((float) 3.4028235E38);
357 desc.setValidator(fieldValidator);
359 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel", org.exolab.castor.xml.NodeType.Attribute);
360 handler = new org.exolab.castor.xml.XMLFieldHandler() {
361 public java.lang.Object getValue( java.lang.Object object )
362 throws IllegalStateException
364 Colour target = (Colour) object;
365 if (!target.hasColourByLabel()) { return null; }
366 return (target.getColourByLabel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
368 public void setValue( java.lang.Object object, java.lang.Object value)
369 throws IllegalStateException, IllegalArgumentException
372 Colour target = (Colour) object;
373 // if null, use delete method for optional primitives
375 target.deleteColourByLabel();
378 target.setColourByLabel( ((java.lang.Boolean) value).booleanValue());
379 } catch (java.lang.Exception ex) {
380 throw new IllegalStateException(ex.toString());
383 public java.lang.Object newInstance(java.lang.Object parent) {
387 desc.setHandler(handler);
388 desc.setMultivalued(false);
389 addFieldDescriptor(desc);
391 //-- validation code for: _colourByLabel
392 fieldValidator = new org.exolab.castor.xml.FieldValidator();
394 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
395 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
396 fieldValidator.setValidator(typeValidator);
398 desc.setValidator(fieldValidator);
400 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoScale", "autoScale", org.exolab.castor.xml.NodeType.Attribute);
401 handler = new org.exolab.castor.xml.XMLFieldHandler() {
402 public java.lang.Object getValue( java.lang.Object object )
403 throws IllegalStateException
405 Colour target = (Colour) object;
406 if (!target.hasAutoScale()) { return null; }
407 return (target.getAutoScale() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
409 public void setValue( java.lang.Object object, java.lang.Object value)
410 throws IllegalStateException, IllegalArgumentException
413 Colour target = (Colour) object;
414 // if null, use delete method for optional primitives
416 target.deleteAutoScale();
419 target.setAutoScale( ((java.lang.Boolean) value).booleanValue());
420 } catch (java.lang.Exception ex) {
421 throw new IllegalStateException(ex.toString());
424 public java.lang.Object newInstance(java.lang.Object parent) {
428 desc.setHandler(handler);
429 desc.setMultivalued(false);
430 addFieldDescriptor(desc);
432 //-- validation code for: _autoScale
433 fieldValidator = new org.exolab.castor.xml.FieldValidator();
435 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
436 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
437 fieldValidator.setValidator(typeValidator);
439 desc.setValidator(fieldValidator);
440 //-- initialize element descriptors
450 * Method getAccessMode.
452 * @return the access mode specified for this class.
454 public org.exolab.castor.mapping.AccessMode getAccessMode(
460 * Method getIdentity.
462 * @return the identity field, null if this class has no
465 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
467 return super.getIdentity();
471 * Method getJavaClass.
473 * @return the Java class represented by this descriptor.
475 public java.lang.Class getJavaClass(
477 return jalview.schemabinding.version2.Colour.class;
481 * Method getNameSpacePrefix.
483 * @return the namespace prefix to use when marshaling as XML.
485 public java.lang.String getNameSpacePrefix(
491 * Method getNameSpaceURI.
493 * @return the namespace URI used when marshaling and
494 * unmarshaling as XML.
496 public java.lang.String getNameSpaceURI(
502 * Method getValidator.
504 * @return a specific validator for the class described by this
507 public org.exolab.castor.xml.TypeValidator getValidator(
515 * @return the XML Name for the Class being described.
517 public java.lang.String getXMLName(
523 * Method isElementDefinition.
525 * @return true if XML schema definition of this Class is that
527 * element or element with anonymous type definition.
529 public boolean isElementDefinition(
531 return _elementDefinition;