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.Setting;
34 * Class SettingDescriptor.
36 * @version $Revision$ $Date$
38 public class SettingDescriptor 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 SettingDescriptor() {
72 _nsURI = "www.jalview.org";
74 _elementDefinition = true;
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(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);
82 desc.setImmutable(true);
83 handler = new org.exolab.castor.xml.XMLFieldHandler() {
84 public java.lang.Object getValue( java.lang.Object object )
85 throws IllegalStateException
87 Setting target = (Setting) object;
88 return target.getType();
90 public void setValue( java.lang.Object object, java.lang.Object value)
91 throws IllegalStateException, IllegalArgumentException
94 Setting target = (Setting) object;
95 target.setType( (java.lang.String) value);
96 } catch (java.lang.Exception ex) {
97 throw new IllegalStateException(ex.toString());
100 public java.lang.Object newInstance(java.lang.Object parent) {
104 desc.setHandler(handler);
105 desc.setRequired(true);
106 desc.setMultivalued(false);
107 addFieldDescriptor(desc);
109 //-- validation code for: _type
110 fieldValidator = new org.exolab.castor.xml.FieldValidator();
111 fieldValidator.setMinOccurs(1);
113 org.exolab.castor.xml.validators.StringValidator typeValidator;
114 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
115 fieldValidator.setValidator(typeValidator);
116 typeValidator.setWhiteSpace("preserve");
118 desc.setValidator(fieldValidator);
120 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
121 handler = new org.exolab.castor.xml.XMLFieldHandler() {
122 public java.lang.Object getValue( java.lang.Object object )
123 throws IllegalStateException
125 Setting target = (Setting) object;
126 if (!target.hasColour()) { return null; }
127 return new java.lang.Integer(target.getColour());
129 public void setValue( java.lang.Object object, java.lang.Object value)
130 throws IllegalStateException, IllegalArgumentException
133 Setting target = (Setting) object;
134 // ignore null values for non optional primitives
135 if (value == null) { return; }
137 target.setColour( ((java.lang.Integer) value).intValue());
138 } catch (java.lang.Exception ex) {
139 throw new IllegalStateException(ex.toString());
142 public java.lang.Object newInstance(java.lang.Object parent) {
146 desc.setHandler(handler);
147 desc.setRequired(true);
148 desc.setMultivalued(false);
149 addFieldDescriptor(desc);
151 //-- validation code for: _colour
152 fieldValidator = new org.exolab.castor.xml.FieldValidator();
153 fieldValidator.setMinOccurs(1);
155 org.exolab.castor.xml.validators.IntValidator typeValidator;
156 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
157 fieldValidator.setValidator(typeValidator);
158 typeValidator.setMinInclusive(-2147483648);
159 typeValidator.setMaxInclusive(2147483647);
161 desc.setValidator(fieldValidator);
163 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_display", "display", org.exolab.castor.xml.NodeType.Attribute);
164 handler = new org.exolab.castor.xml.XMLFieldHandler() {
165 public java.lang.Object getValue( java.lang.Object object )
166 throws IllegalStateException
168 Setting target = (Setting) object;
169 if (!target.hasDisplay()) { return null; }
170 return (target.getDisplay() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
172 public void setValue( java.lang.Object object, java.lang.Object value)
173 throws IllegalStateException, IllegalArgumentException
176 Setting target = (Setting) object;
177 // ignore null values for non optional primitives
178 if (value == null) { return; }
180 target.setDisplay( ((java.lang.Boolean) value).booleanValue());
181 } catch (java.lang.Exception ex) {
182 throw new IllegalStateException(ex.toString());
185 public java.lang.Object newInstance(java.lang.Object parent) {
189 desc.setHandler(handler);
190 desc.setRequired(true);
191 desc.setMultivalued(false);
192 addFieldDescriptor(desc);
194 //-- validation code for: _display
195 fieldValidator = new org.exolab.castor.xml.FieldValidator();
196 fieldValidator.setMinOccurs(1);
198 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
199 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
200 fieldValidator.setValidator(typeValidator);
202 desc.setValidator(fieldValidator);
204 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_order", "order", org.exolab.castor.xml.NodeType.Attribute);
205 handler = new org.exolab.castor.xml.XMLFieldHandler() {
206 public java.lang.Object getValue( java.lang.Object object )
207 throws IllegalStateException
209 Setting target = (Setting) object;
210 if (!target.hasOrder()) { return null; }
211 return new java.lang.Float(target.getOrder());
213 public void setValue( java.lang.Object object, java.lang.Object value)
214 throws IllegalStateException, IllegalArgumentException
217 Setting target = (Setting) object;
218 // if null, use delete method for optional primitives
220 target.deleteOrder();
223 target.setOrder( ((java.lang.Float) value).floatValue());
224 } catch (java.lang.Exception ex) {
225 throw new IllegalStateException(ex.toString());
228 public java.lang.Object newInstance(java.lang.Object parent) {
232 desc.setHandler(handler);
233 desc.setMultivalued(false);
234 addFieldDescriptor(desc);
236 //-- validation code for: _order
237 fieldValidator = new org.exolab.castor.xml.FieldValidator();
239 org.exolab.castor.xml.validators.FloatValidator typeValidator;
240 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
241 fieldValidator.setValidator(typeValidator);
242 typeValidator.setMinInclusive((float) -3.4028235E38);
243 typeValidator.setMaxInclusive((float) 3.4028235E38);
245 desc.setValidator(fieldValidator);
247 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_mincolour", "mincolour", org.exolab.castor.xml.NodeType.Attribute);
248 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.hasMincolour()) { return null; }
254 return new java.lang.Integer(target.getMincolour());
256 public void setValue( java.lang.Object object, java.lang.Object value)
257 throws IllegalStateException, IllegalArgumentException
260 Setting target = (Setting) object;
261 // if null, use delete method for optional primitives
263 target.deleteMincolour();
266 target.setMincolour( ((java.lang.Integer) value).intValue());
267 } catch (java.lang.Exception ex) {
268 throw new IllegalStateException(ex.toString());
271 public java.lang.Object newInstance(java.lang.Object parent) {
275 desc.setHandler(handler);
276 desc.setMultivalued(false);
277 addFieldDescriptor(desc);
279 //-- validation code for: _mincolour
280 fieldValidator = new org.exolab.castor.xml.FieldValidator();
282 org.exolab.castor.xml.validators.IntValidator typeValidator;
283 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
284 fieldValidator.setValidator(typeValidator);
285 typeValidator.setMinInclusive(-2147483648);
286 typeValidator.setMaxInclusive(2147483647);
288 desc.setValidator(fieldValidator);
290 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
291 handler = new org.exolab.castor.xml.XMLFieldHandler() {
292 public java.lang.Object getValue( java.lang.Object object )
293 throws IllegalStateException
295 Setting target = (Setting) object;
296 if (!target.hasThreshold()) { return null; }
297 return new java.lang.Float(target.getThreshold());
299 public void setValue( java.lang.Object object, java.lang.Object value)
300 throws IllegalStateException, IllegalArgumentException
303 Setting target = (Setting) object;
304 // if null, use delete method for optional primitives
306 target.deleteThreshold();
309 target.setThreshold( ((java.lang.Float) value).floatValue());
310 } catch (java.lang.Exception ex) {
311 throw new IllegalStateException(ex.toString());
314 public java.lang.Object newInstance(java.lang.Object parent) {
318 desc.setHandler(handler);
319 desc.setMultivalued(false);
320 addFieldDescriptor(desc);
322 //-- validation code for: _threshold
323 fieldValidator = new org.exolab.castor.xml.FieldValidator();
325 org.exolab.castor.xml.validators.FloatValidator typeValidator;
326 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
327 fieldValidator.setValidator(typeValidator);
328 typeValidator.setMinInclusive((float) -3.4028235E38);
329 typeValidator.setMaxInclusive((float) 3.4028235E38);
331 desc.setValidator(fieldValidator);
333 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_threshstate", "threshstate", org.exolab.castor.xml.NodeType.Attribute);
334 handler = new org.exolab.castor.xml.XMLFieldHandler() {
335 public java.lang.Object getValue( java.lang.Object object )
336 throws IllegalStateException
338 Setting target = (Setting) object;
339 if (!target.hasThreshstate()) { return null; }
340 return new java.lang.Integer(target.getThreshstate());
342 public void setValue( java.lang.Object object, java.lang.Object value)
343 throws IllegalStateException, IllegalArgumentException
346 Setting target = (Setting) object;
347 // if null, use delete method for optional primitives
349 target.deleteThreshstate();
352 target.setThreshstate( ((java.lang.Integer) value).intValue());
353 } catch (java.lang.Exception ex) {
354 throw new IllegalStateException(ex.toString());
357 public java.lang.Object newInstance(java.lang.Object parent) {
361 desc.setHandler(handler);
362 desc.setMultivalued(false);
363 addFieldDescriptor(desc);
365 //-- validation code for: _threshstate
366 fieldValidator = new org.exolab.castor.xml.FieldValidator();
368 org.exolab.castor.xml.validators.IntValidator typeValidator;
369 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
370 fieldValidator.setValidator(typeValidator);
371 typeValidator.setMinInclusive(-2147483648);
372 typeValidator.setMaxInclusive(2147483647);
374 desc.setValidator(fieldValidator);
376 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_max", "max", org.exolab.castor.xml.NodeType.Attribute);
377 handler = new org.exolab.castor.xml.XMLFieldHandler() {
378 public java.lang.Object getValue( java.lang.Object object )
379 throws IllegalStateException
381 Setting target = (Setting) object;
382 if (!target.hasMax()) { return null; }
383 return new java.lang.Float(target.getMax());
385 public void setValue( java.lang.Object object, java.lang.Object value)
386 throws IllegalStateException, IllegalArgumentException
389 Setting target = (Setting) object;
390 // if null, use delete method for optional primitives
395 target.setMax( ((java.lang.Float) value).floatValue());
396 } catch (java.lang.Exception ex) {
397 throw new IllegalStateException(ex.toString());
400 public java.lang.Object newInstance(java.lang.Object parent) {
404 desc.setHandler(handler);
405 desc.setMultivalued(false);
406 addFieldDescriptor(desc);
408 //-- validation code for: _max
409 fieldValidator = new org.exolab.castor.xml.FieldValidator();
411 org.exolab.castor.xml.validators.FloatValidator typeValidator;
412 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
413 fieldValidator.setValidator(typeValidator);
414 typeValidator.setMinInclusive((float) -3.4028235E38);
415 typeValidator.setMaxInclusive((float) 3.4028235E38);
417 desc.setValidator(fieldValidator);
419 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_min", "min", org.exolab.castor.xml.NodeType.Attribute);
420 handler = new org.exolab.castor.xml.XMLFieldHandler() {
421 public java.lang.Object getValue( java.lang.Object object )
422 throws IllegalStateException
424 Setting target = (Setting) object;
425 if (!target.hasMin()) { return null; }
426 return new java.lang.Float(target.getMin());
428 public void setValue( java.lang.Object object, java.lang.Object value)
429 throws IllegalStateException, IllegalArgumentException
432 Setting target = (Setting) object;
433 // if null, use delete method for optional primitives
438 target.setMin( ((java.lang.Float) value).floatValue());
439 } catch (java.lang.Exception ex) {
440 throw new IllegalStateException(ex.toString());
443 public java.lang.Object newInstance(java.lang.Object parent) {
447 desc.setHandler(handler);
448 desc.setMultivalued(false);
449 addFieldDescriptor(desc);
451 //-- validation code for: _min
452 fieldValidator = new org.exolab.castor.xml.FieldValidator();
454 org.exolab.castor.xml.validators.FloatValidator typeValidator;
455 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
456 fieldValidator.setValidator(typeValidator);
457 typeValidator.setMinInclusive((float) -3.4028235E38);
458 typeValidator.setMaxInclusive((float) 3.4028235E38);
460 desc.setValidator(fieldValidator);
462 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel", org.exolab.castor.xml.NodeType.Attribute);
463 handler = new org.exolab.castor.xml.XMLFieldHandler() {
464 public java.lang.Object getValue( java.lang.Object object )
465 throws IllegalStateException
467 Setting target = (Setting) object;
468 if (!target.hasColourByLabel()) { return null; }
469 return (target.getColourByLabel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
471 public void setValue( java.lang.Object object, java.lang.Object value)
472 throws IllegalStateException, IllegalArgumentException
475 Setting target = (Setting) object;
476 // if null, use delete method for optional primitives
478 target.deleteColourByLabel();
481 target.setColourByLabel( ((java.lang.Boolean) value).booleanValue());
482 } catch (java.lang.Exception ex) {
483 throw new IllegalStateException(ex.toString());
486 public java.lang.Object newInstance(java.lang.Object parent) {
490 desc.setHandler(handler);
491 desc.setMultivalued(false);
492 addFieldDescriptor(desc);
494 //-- validation code for: _colourByLabel
495 fieldValidator = new org.exolab.castor.xml.FieldValidator();
497 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
498 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
499 fieldValidator.setValidator(typeValidator);
501 desc.setValidator(fieldValidator);
503 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoScale", "autoScale", org.exolab.castor.xml.NodeType.Attribute);
504 handler = new org.exolab.castor.xml.XMLFieldHandler() {
505 public java.lang.Object getValue( java.lang.Object object )
506 throws IllegalStateException
508 Setting target = (Setting) object;
509 if (!target.hasAutoScale()) { return null; }
510 return (target.getAutoScale() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
512 public void setValue( java.lang.Object object, java.lang.Object value)
513 throws IllegalStateException, IllegalArgumentException
516 Setting target = (Setting) object;
517 // if null, use delete method for optional primitives
519 target.deleteAutoScale();
522 target.setAutoScale( ((java.lang.Boolean) value).booleanValue());
523 } catch (java.lang.Exception ex) {
524 throw new IllegalStateException(ex.toString());
527 public java.lang.Object newInstance(java.lang.Object parent) {
531 desc.setHandler(handler);
532 desc.setMultivalued(false);
533 addFieldDescriptor(desc);
535 //-- validation code for: _autoScale
536 fieldValidator = new org.exolab.castor.xml.FieldValidator();
538 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
539 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
540 fieldValidator.setValidator(typeValidator);
542 desc.setValidator(fieldValidator);
543 //-- initialize element descriptors
553 * Method getAccessMode.
555 * @return the access mode specified for this class.
557 public org.exolab.castor.mapping.AccessMode getAccessMode(
563 * Method getIdentity.
565 * @return the identity field, null if this class has no
568 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
570 return super.getIdentity();
574 * Method getJavaClass.
576 * @return the Java class represented by this descriptor.
578 public java.lang.Class getJavaClass(
580 return jalview.schemabinding.version2.Setting.class;
584 * Method getNameSpacePrefix.
586 * @return the namespace prefix to use when marshaling as XML.
588 public java.lang.String getNameSpacePrefix(
594 * Method getNameSpaceURI.
596 * @return the namespace URI used when marshaling and
597 * unmarshaling as XML.
599 public java.lang.String getNameSpaceURI(
605 * Method getValidator.
607 * @return a specific validator for the class described by this
610 public org.exolab.castor.xml.TypeValidator getValidator(
618 * @return the XML Name for the Class being described.
620 public java.lang.String getXMLName(
626 * Method isElementDefinition.
628 * @return true if XML schema definition of this Class is that
630 * element or element with anonymous type definition.
632 public boolean isElementDefinition(
634 return _elementDefinition;