2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6.1)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2.descriptors;
\r
20 //---------------------------------/
\r
21 //- Imported classes and packages -/
\r
22 //---------------------------------/
\r
24 import jalview.schemabinding.version2.ThresholdLine;
\r
27 * Class ThresholdLineDescriptor.
\r
29 * @version $Revision$ $Date$
\r
31 public class ThresholdLineDescriptor extends
\r
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
\r
35 // --------------------------/
\r
36 // - Class/Member Variables -/
\r
37 // --------------------------/
\r
40 * Field _elementDefinition.
\r
42 private boolean _elementDefinition;
\r
47 private java.lang.String _nsPrefix;
\r
52 private java.lang.String _nsURI;
\r
57 private java.lang.String _xmlName;
\r
59 // ----------------/
\r
60 // - Constructors -/
\r
61 // ----------------/
\r
63 public ThresholdLineDescriptor()
\r
66 _nsURI = "www.vamsas.ac.uk/jalview/version2";
\r
67 _xmlName = "thresholdLine";
\r
68 _elementDefinition = true;
\r
69 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
\r
70 org.exolab.castor.mapping.FieldHandler handler = null;
\r
71 org.exolab.castor.xml.FieldValidator fieldValidator = null;
\r
72 // -- initialize attribute descriptors
\r
75 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
76 java.lang.String.class, "_label", "label",
\r
77 org.exolab.castor.xml.NodeType.Attribute);
\r
78 desc.setImmutable(true);
\r
79 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
81 public java.lang.Object getValue(java.lang.Object object)
\r
82 throws IllegalStateException
\r
84 ThresholdLine target = (ThresholdLine) object;
\r
85 return target.getLabel();
\r
88 public void setValue(java.lang.Object object, java.lang.Object value)
\r
89 throws IllegalStateException, IllegalArgumentException
\r
93 ThresholdLine target = (ThresholdLine) object;
\r
94 target.setLabel((java.lang.String) value);
\r
95 } catch (java.lang.Exception ex)
\r
97 throw new IllegalStateException(ex.toString());
\r
101 public java.lang.Object newInstance(java.lang.Object parent)
\r
106 desc.setHandler(handler);
\r
107 desc.setMultivalued(false);
\r
108 addFieldDescriptor(desc);
\r
110 // -- validation code for: _label
\r
111 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
112 { // -- local scope
\r
113 org.exolab.castor.xml.validators.StringValidator typeValidator;
\r
114 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
\r
115 fieldValidator.setValidator(typeValidator);
\r
116 typeValidator.setWhiteSpace("preserve");
\r
118 desc.setValidator(fieldValidator);
\r
120 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
121 java.lang.Float.TYPE, "_value", "value",
\r
122 org.exolab.castor.xml.NodeType.Attribute);
\r
123 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
125 public java.lang.Object getValue(java.lang.Object object)
\r
126 throws IllegalStateException
\r
128 ThresholdLine target = (ThresholdLine) object;
\r
129 if (!target.hasValue())
\r
133 return new java.lang.Float(target.getValue());
\r
136 public void setValue(java.lang.Object object, java.lang.Object value)
\r
137 throws IllegalStateException, IllegalArgumentException
\r
141 ThresholdLine target = (ThresholdLine) object;
\r
142 // if null, use delete method for optional primitives
\r
145 target.deleteValue();
\r
148 target.setValue(((java.lang.Float) value).floatValue());
\r
149 } catch (java.lang.Exception ex)
\r
151 throw new IllegalStateException(ex.toString());
\r
155 public java.lang.Object newInstance(java.lang.Object parent)
\r
160 desc.setHandler(handler);
\r
161 desc.setMultivalued(false);
\r
162 addFieldDescriptor(desc);
\r
164 // -- validation code for: _value
\r
165 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
166 { // -- local scope
\r
167 org.exolab.castor.xml.validators.FloatValidator typeValidator;
\r
168 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
\r
169 fieldValidator.setValidator(typeValidator);
\r
170 typeValidator.setMinInclusive((float) -3.4028235E38);
\r
171 typeValidator.setMaxInclusive((float) 3.4028235E38);
\r
173 desc.setValidator(fieldValidator);
\r
175 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
176 java.lang.Integer.TYPE, "_colour", "colour",
\r
177 org.exolab.castor.xml.NodeType.Attribute);
\r
178 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
180 public java.lang.Object getValue(java.lang.Object object)
\r
181 throws IllegalStateException
\r
183 ThresholdLine target = (ThresholdLine) object;
\r
184 if (!target.hasColour())
\r
188 return new java.lang.Integer(target.getColour());
\r
191 public void setValue(java.lang.Object object, java.lang.Object value)
\r
192 throws IllegalStateException, IllegalArgumentException
\r
196 ThresholdLine target = (ThresholdLine) object;
\r
197 // if null, use delete method for optional primitives
\r
200 target.deleteColour();
\r
203 target.setColour(((java.lang.Integer) value).intValue());
\r
204 } catch (java.lang.Exception ex)
\r
206 throw new IllegalStateException(ex.toString());
\r
210 public java.lang.Object newInstance(java.lang.Object parent)
\r
215 desc.setHandler(handler);
\r
216 desc.setMultivalued(false);
\r
217 addFieldDescriptor(desc);
\r
219 // -- validation code for: _colour
\r
220 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
221 { // -- local scope
\r
222 org.exolab.castor.xml.validators.IntValidator typeValidator;
\r
223 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
\r
224 fieldValidator.setValidator(typeValidator);
\r
225 typeValidator.setMinInclusive(-2147483648);
\r
226 typeValidator.setMaxInclusive(2147483647);
\r
228 desc.setValidator(fieldValidator);
\r
229 // -- initialize element descriptors
\r
238 * Method getAccessMode.
\r
240 * @return the access mode specified for this class.
\r
242 public org.exolab.castor.mapping.AccessMode getAccessMode()
\r
248 * Method getIdentity.
\r
250 * @return the identity field, null if this class has no identity.
\r
252 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
\r
254 return super.getIdentity();
\r
258 * Method getJavaClass.
\r
260 * @return the Java class represented by this descriptor.
\r
262 public java.lang.Class getJavaClass()
\r
264 return jalview.schemabinding.version2.ThresholdLine.class;
\r
268 * Method getNameSpacePrefix.
\r
270 * @return the namespace prefix to use when marshaling as XML.
\r
272 public java.lang.String getNameSpacePrefix()
\r
278 * Method getNameSpaceURI.
\r
280 * @return the namespace URI used when marshaling and unmarshaling as XML.
\r
282 public java.lang.String getNameSpaceURI()
\r
288 * Method getValidator.
\r
290 * @return a specific validator for the class described by this
\r
293 public org.exolab.castor.xml.TypeValidator getValidator()
\r
299 * Method getXMLName.
\r
301 * @return the XML Name for the Class being described.
\r
303 public java.lang.String getXMLName()
\r
309 * Method isElementDefinition.
\r
311 * @return true if XML schema definition of this Class is that of a global
\r
312 * element or element with anonymous type definition.
\r
314 public boolean isElementDefinition()
\r
316 return _elementDefinition;
\r