2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2.descriptors;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import jalview.schemabinding.version2.ThresholdLine;
\r
28 * Class ThresholdLineDescriptor.
\r
30 * @version $Revision$ $Date$
\r
32 public class ThresholdLineDescriptor extends
\r
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
41 * Field _elementDefinition.
\r
43 private boolean _elementDefinition;
\r
48 private java.lang.String _nsPrefix;
\r
53 private java.lang.String _nsURI;
\r
58 private java.lang.String _xmlName;
\r
60 // ----------------/
\r
61 // - Constructors -/
\r
62 // ----------------/
\r
64 public ThresholdLineDescriptor()
\r
67 _nsURI = "www.vamsas.ac.uk/jalview/version2";
\r
68 _xmlName = "thresholdLine";
\r
69 _elementDefinition = true;
\r
70 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
\r
71 org.exolab.castor.mapping.FieldHandler handler = null;
\r
72 org.exolab.castor.xml.FieldValidator fieldValidator = null;
\r
73 // -- initialize attribute descriptors
\r
76 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
77 java.lang.String.class, "_label", "label",
\r
78 org.exolab.castor.xml.NodeType.Attribute);
\r
79 desc.setImmutable(true);
\r
80 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
82 public java.lang.Object getValue(java.lang.Object object)
\r
83 throws IllegalStateException
\r
85 ThresholdLine target = (ThresholdLine) object;
\r
86 return target.getLabel();
\r
89 public void setValue(java.lang.Object object, java.lang.Object value)
\r
90 throws IllegalStateException, IllegalArgumentException
\r
94 ThresholdLine target = (ThresholdLine) object;
\r
95 target.setLabel((java.lang.String) value);
\r
96 } catch (java.lang.Exception ex)
\r
98 throw new IllegalStateException(ex.toString());
\r
102 public java.lang.Object newInstance(java.lang.Object parent)
\r
107 desc.setHandler(handler);
\r
108 desc.setMultivalued(false);
\r
109 addFieldDescriptor(desc);
\r
111 // -- validation code for: _label
\r
112 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
113 { // -- local scope
\r
114 org.exolab.castor.xml.validators.StringValidator typeValidator;
\r
115 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
\r
116 fieldValidator.setValidator(typeValidator);
\r
117 typeValidator.setWhiteSpace("preserve");
\r
119 desc.setValidator(fieldValidator);
\r
121 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
122 java.lang.Float.TYPE, "_value", "value",
\r
123 org.exolab.castor.xml.NodeType.Attribute);
\r
124 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
126 public java.lang.Object getValue(java.lang.Object object)
\r
127 throws IllegalStateException
\r
129 ThresholdLine target = (ThresholdLine) object;
\r
130 if (!target.hasValue())
\r
134 return new java.lang.Float(target.getValue());
\r
137 public void setValue(java.lang.Object object, java.lang.Object value)
\r
138 throws IllegalStateException, IllegalArgumentException
\r
142 ThresholdLine target = (ThresholdLine) object;
\r
143 // if null, use delete method for optional primitives
\r
146 target.deleteValue();
\r
149 target.setValue(((java.lang.Float) value).floatValue());
\r
150 } catch (java.lang.Exception ex)
\r
152 throw new IllegalStateException(ex.toString());
\r
156 public java.lang.Object newInstance(java.lang.Object parent)
\r
161 desc.setHandler(handler);
\r
162 desc.setMultivalued(false);
\r
163 addFieldDescriptor(desc);
\r
165 // -- validation code for: _value
\r
166 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
167 { // -- local scope
\r
168 org.exolab.castor.xml.validators.FloatValidator typeValidator;
\r
169 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
\r
170 fieldValidator.setValidator(typeValidator);
\r
171 typeValidator.setMinInclusive((float) -3.4028235E38);
\r
172 typeValidator.setMaxInclusive((float) 3.4028235E38);
\r
174 desc.setValidator(fieldValidator);
\r
176 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
\r
177 java.lang.Integer.TYPE, "_colour", "colour",
\r
178 org.exolab.castor.xml.NodeType.Attribute);
\r
179 handler = new org.exolab.castor.xml.XMLFieldHandler()
\r
181 public java.lang.Object getValue(java.lang.Object object)
\r
182 throws IllegalStateException
\r
184 ThresholdLine target = (ThresholdLine) object;
\r
185 if (!target.hasColour())
\r
189 return new java.lang.Integer(target.getColour());
\r
192 public void setValue(java.lang.Object object, java.lang.Object value)
\r
193 throws IllegalStateException, IllegalArgumentException
\r
197 ThresholdLine target = (ThresholdLine) object;
\r
198 // if null, use delete method for optional primitives
\r
201 target.deleteColour();
\r
204 target.setColour(((java.lang.Integer) value).intValue());
\r
205 } catch (java.lang.Exception ex)
\r
207 throw new IllegalStateException(ex.toString());
\r
211 public java.lang.Object newInstance(java.lang.Object parent)
\r
216 desc.setHandler(handler);
\r
217 desc.setMultivalued(false);
\r
218 addFieldDescriptor(desc);
\r
220 // -- validation code for: _colour
\r
221 fieldValidator = new org.exolab.castor.xml.FieldValidator();
\r
222 { // -- local scope
\r
223 org.exolab.castor.xml.validators.IntValidator typeValidator;
\r
224 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
\r
225 fieldValidator.setValidator(typeValidator);
\r
226 typeValidator.setMinInclusive(-2147483648);
\r
227 typeValidator.setMaxInclusive(2147483647);
\r
229 desc.setValidator(fieldValidator);
\r
230 // -- initialize element descriptors
\r
239 * Method getAccessMode.
\r
241 * @return the access mode specified for this class.
\r
243 public org.exolab.castor.mapping.AccessMode getAccessMode()
\r
249 * Method getIdentity.
\r
251 * @return the identity field, null if this class has no identity.
\r
253 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
\r
255 return super.getIdentity();
\r
259 * Method getJavaClass.
\r
261 * @return the Java class represented by this descriptor.
\r
263 public java.lang.Class getJavaClass()
\r
265 return jalview.schemabinding.version2.ThresholdLine.class;
\r
269 * Method getNameSpacePrefix.
\r
271 * @return the namespace prefix to use when marshaling as XML.
\r
273 public java.lang.String getNameSpacePrefix()
\r
279 * Method getNameSpaceURI.
\r
281 * @return the namespace URI used when marshaling and unmarshaling as XML.
\r
283 public java.lang.String getNameSpaceURI()
\r
289 * Method getValidator.
\r
291 * @return a specific validator for the class described by this
\r
294 public org.exolab.castor.xml.TypeValidator getValidator()
\r
300 * Method getXMLName.
\r
302 * @return the XML Name for the Class being described.
\r
304 public java.lang.String getXMLName()
\r
310 * Method isElementDefinition.
\r
312 * @return true if XML schema definition of this Class is that of a global
\r
313 * element or element with anonymous type definition.
\r
315 public boolean isElementDefinition()
\r
317 return _elementDefinition;
\r