2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.ThresholdLine;
28 * Class ThresholdLineDescriptor.
30 * @version $Revision$ $Date$
32 public class ThresholdLineDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public ThresholdLineDescriptor()
67 _nsURI = "www.vamsas.ac.uk/jalview/version2";
68 _xmlName = "thresholdLine";
69 _elementDefinition = true;
70 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
71 org.exolab.castor.mapping.FieldHandler handler = null;
72 org.exolab.castor.xml.FieldValidator fieldValidator = null;
73 // -- initialize attribute descriptors
76 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
77 java.lang.String.class, "_label", "label",
78 org.exolab.castor.xml.NodeType.Attribute);
79 desc.setImmutable(true);
80 handler = new org.exolab.castor.xml.XMLFieldHandler()
82 public java.lang.Object getValue(java.lang.Object object)
83 throws IllegalStateException
85 ThresholdLine target = (ThresholdLine) object;
86 return target.getLabel();
89 public void setValue(java.lang.Object object, java.lang.Object value)
90 throws IllegalStateException, IllegalArgumentException
94 ThresholdLine target = (ThresholdLine) object;
95 target.setLabel((java.lang.String) value);
96 } catch (java.lang.Exception ex)
98 throw new IllegalStateException(ex.toString());
102 public java.lang.Object newInstance(java.lang.Object parent)
107 desc.setHandler(handler);
108 desc.setMultivalued(false);
109 addFieldDescriptor(desc);
111 // -- validation code for: _label
112 fieldValidator = new org.exolab.castor.xml.FieldValidator();
114 org.exolab.castor.xml.validators.StringValidator typeValidator;
115 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
116 fieldValidator.setValidator(typeValidator);
117 typeValidator.setWhiteSpace("preserve");
119 desc.setValidator(fieldValidator);
121 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
122 java.lang.Float.TYPE, "_value", "value",
123 org.exolab.castor.xml.NodeType.Attribute);
124 handler = new org.exolab.castor.xml.XMLFieldHandler()
126 public java.lang.Object getValue(java.lang.Object object)
127 throws IllegalStateException
129 ThresholdLine target = (ThresholdLine) object;
130 if (!target.hasValue())
134 return new java.lang.Float(target.getValue());
137 public void setValue(java.lang.Object object, java.lang.Object value)
138 throws IllegalStateException, IllegalArgumentException
142 ThresholdLine target = (ThresholdLine) object;
143 // if null, use delete method for optional primitives
146 target.deleteValue();
149 target.setValue(((java.lang.Float) value).floatValue());
150 } catch (java.lang.Exception ex)
152 throw new IllegalStateException(ex.toString());
156 public java.lang.Object newInstance(java.lang.Object parent)
161 desc.setHandler(handler);
162 desc.setMultivalued(false);
163 addFieldDescriptor(desc);
165 // -- validation code for: _value
166 fieldValidator = new org.exolab.castor.xml.FieldValidator();
168 org.exolab.castor.xml.validators.FloatValidator typeValidator;
169 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
170 fieldValidator.setValidator(typeValidator);
171 typeValidator.setMinInclusive((float) -3.4028235E38);
172 typeValidator.setMaxInclusive((float) 3.4028235E38);
174 desc.setValidator(fieldValidator);
176 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
177 java.lang.Integer.TYPE, "_colour", "colour",
178 org.exolab.castor.xml.NodeType.Attribute);
179 handler = new org.exolab.castor.xml.XMLFieldHandler()
181 public java.lang.Object getValue(java.lang.Object object)
182 throws IllegalStateException
184 ThresholdLine target = (ThresholdLine) object;
185 if (!target.hasColour())
189 return new java.lang.Integer(target.getColour());
192 public void setValue(java.lang.Object object, java.lang.Object value)
193 throws IllegalStateException, IllegalArgumentException
197 ThresholdLine target = (ThresholdLine) object;
198 // if null, use delete method for optional primitives
201 target.deleteColour();
204 target.setColour(((java.lang.Integer) value).intValue());
205 } catch (java.lang.Exception ex)
207 throw new IllegalStateException(ex.toString());
211 public java.lang.Object newInstance(java.lang.Object parent)
216 desc.setHandler(handler);
217 desc.setMultivalued(false);
218 addFieldDescriptor(desc);
220 // -- validation code for: _colour
221 fieldValidator = new org.exolab.castor.xml.FieldValidator();
223 org.exolab.castor.xml.validators.IntValidator typeValidator;
224 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
225 fieldValidator.setValidator(typeValidator);
226 typeValidator.setMinInclusive(-2147483648);
227 typeValidator.setMaxInclusive(2147483647);
229 desc.setValidator(fieldValidator);
230 // -- initialize element descriptors
239 * Method getAccessMode.
241 * @return the access mode specified for this class.
243 public org.exolab.castor.mapping.AccessMode getAccessMode()
249 * Method getIdentity.
251 * @return the identity field, null if this class has no identity.
253 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
255 return super.getIdentity();
259 * Method getJavaClass.
261 * @return the Java class represented by this descriptor.
263 public java.lang.Class getJavaClass()
265 return jalview.schemabinding.version2.ThresholdLine.class;
269 * Method getNameSpacePrefix.
271 * @return the namespace prefix to use when marshaling as XML.
273 public java.lang.String getNameSpacePrefix()
279 * Method getNameSpaceURI.
281 * @return the namespace URI used when marshaling and unmarshaling as XML.
283 public java.lang.String getNameSpaceURI()
289 * Method getValidator.
291 * @return a specific validator for the class described by this
294 public org.exolab.castor.xml.TypeValidator getValidator()
302 * @return the XML Name for the Class being described.
304 public java.lang.String getXMLName()
310 * Method isElementDefinition.
312 * @return true if XML schema definition of this Class is that of a global
313 * element or element with anonymous type definition.
315 public boolean isElementDefinition()
317 return _elementDefinition;