2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.ThresholdLine;
27 * Class ThresholdLineDescriptor.
29 * @version $Revision$ $Date$
31 public class ThresholdLineDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public ThresholdLineDescriptor()
66 _nsURI = "www.vamsas.ac.uk/jalview/version2";
67 _xmlName = "thresholdLine";
68 _elementDefinition = true;
69 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
70 org.exolab.castor.mapping.FieldHandler handler = null;
71 org.exolab.castor.xml.FieldValidator fieldValidator = null;
72 // -- initialize attribute descriptors
75 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
76 java.lang.String.class, "_label", "label",
77 org.exolab.castor.xml.NodeType.Attribute);
78 desc.setImmutable(true);
79 handler = new org.exolab.castor.xml.XMLFieldHandler()
81 public java.lang.Object getValue(java.lang.Object object)
82 throws IllegalStateException
84 ThresholdLine target = (ThresholdLine) object;
85 return target.getLabel();
88 public void setValue(java.lang.Object object, java.lang.Object value)
89 throws IllegalStateException, IllegalArgumentException
93 ThresholdLine target = (ThresholdLine) object;
94 target.setLabel((java.lang.String) value);
95 } catch (java.lang.Exception ex)
97 throw new IllegalStateException(ex.toString());
101 public java.lang.Object newInstance(java.lang.Object parent)
106 desc.setHandler(handler);
107 desc.setMultivalued(false);
108 addFieldDescriptor(desc);
110 // -- validation code for: _label
111 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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(
121 java.lang.Float.TYPE, "_value", "value",
122 org.exolab.castor.xml.NodeType.Attribute);
123 handler = new org.exolab.castor.xml.XMLFieldHandler()
125 public java.lang.Object getValue(java.lang.Object object)
126 throws IllegalStateException
128 ThresholdLine target = (ThresholdLine) object;
129 if (!target.hasValue())
133 return new java.lang.Float(target.getValue());
136 public void setValue(java.lang.Object object, java.lang.Object value)
137 throws IllegalStateException, IllegalArgumentException
141 ThresholdLine target = (ThresholdLine) object;
142 // if null, use delete method for optional primitives
145 target.deleteValue();
148 target.setValue(((java.lang.Float) value).floatValue());
149 } catch (java.lang.Exception ex)
151 throw new IllegalStateException(ex.toString());
155 public java.lang.Object newInstance(java.lang.Object parent)
160 desc.setHandler(handler);
161 desc.setMultivalued(false);
162 addFieldDescriptor(desc);
164 // -- validation code for: _value
165 fieldValidator = new org.exolab.castor.xml.FieldValidator();
167 org.exolab.castor.xml.validators.FloatValidator typeValidator;
168 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
169 fieldValidator.setValidator(typeValidator);
170 typeValidator.setMinInclusive((float) -3.4028235E38);
171 typeValidator.setMaxInclusive((float) 3.4028235E38);
173 desc.setValidator(fieldValidator);
175 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
176 java.lang.Integer.TYPE, "_colour", "colour",
177 org.exolab.castor.xml.NodeType.Attribute);
178 handler = new org.exolab.castor.xml.XMLFieldHandler()
180 public java.lang.Object getValue(java.lang.Object object)
181 throws IllegalStateException
183 ThresholdLine target = (ThresholdLine) object;
184 if (!target.hasColour())
188 return new java.lang.Integer(target.getColour());
191 public void setValue(java.lang.Object object, java.lang.Object value)
192 throws IllegalStateException, IllegalArgumentException
196 ThresholdLine target = (ThresholdLine) object;
197 // if null, use delete method for optional primitives
200 target.deleteColour();
203 target.setColour(((java.lang.Integer) value).intValue());
204 } catch (java.lang.Exception ex)
206 throw new IllegalStateException(ex.toString());
210 public java.lang.Object newInstance(java.lang.Object parent)
215 desc.setHandler(handler);
216 desc.setMultivalued(false);
217 addFieldDescriptor(desc);
219 // -- validation code for: _colour
220 fieldValidator = new org.exolab.castor.xml.FieldValidator();
222 org.exolab.castor.xml.validators.IntValidator typeValidator;
223 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
224 fieldValidator.setValidator(typeValidator);
225 typeValidator.setMinInclusive(-2147483648);
226 typeValidator.setMaxInclusive(2147483647);
228 desc.setValidator(fieldValidator);
229 // -- initialize element descriptors
238 * Method getAccessMode.
240 * @return the access mode specified for this class.
242 public org.exolab.castor.mapping.AccessMode getAccessMode()
248 * Method getIdentity.
250 * @return the identity field, null if this class has no identity.
252 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
254 return super.getIdentity();
258 * Method getJavaClass.
260 * @return the Java class represented by this descriptor.
262 public java.lang.Class getJavaClass()
264 return jalview.schemabinding.version2.ThresholdLine.class;
268 * Method getNameSpacePrefix.
270 * @return the namespace prefix to use when marshaling as XML.
272 public java.lang.String getNameSpacePrefix()
278 * Method getNameSpaceURI.
280 * @return the namespace URI used when marshaling and unmarshaling as XML.
282 public java.lang.String getNameSpaceURI()
288 * Method getValidator.
290 * @return a specific validator for the class described by this
293 public org.exolab.castor.xml.TypeValidator getValidator()
301 * @return the XML Name for the Class being described.
303 public java.lang.String getXMLName()
309 * Method isElementDefinition.
311 * @return true if XML schema definition of this Class is that of a global
312 * element or element with anonymous type definition.
314 public boolean isElementDefinition()
316 return _elementDefinition;