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.Colour;
26 import jalview.schemabinding.version2.JalviewUserColours;
29 * Class JalviewUserColoursDescriptor.
31 * @version $Revision$ $Date$
33 public class JalviewUserColoursDescriptor extends
34 org.exolab.castor.xml.util.XMLClassDescriptorImpl
37 // --------------------------/
38 // - Class/Member Variables -/
39 // --------------------------/
42 * Field _elementDefinition.
44 private boolean _elementDefinition;
49 private java.lang.String _nsPrefix;
54 private java.lang.String _nsURI;
59 private java.lang.String _xmlName;
65 public JalviewUserColoursDescriptor()
68 _nsURI = "www.jalview.org/colours";
69 _xmlName = "JalviewUserColours";
70 _elementDefinition = false;
72 // -- set grouping compositor
73 setCompositorAsSequence();
74 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
75 org.exolab.castor.mapping.FieldHandler handler = null;
76 org.exolab.castor.xml.FieldValidator fieldValidator = null;
77 // -- initialize attribute descriptors
80 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
81 java.lang.String.class, "_schemeName", "schemeName",
82 org.exolab.castor.xml.NodeType.Attribute);
83 desc.setImmutable(true);
84 handler = new org.exolab.castor.xml.XMLFieldHandler()
86 public java.lang.Object getValue(java.lang.Object object)
87 throws IllegalStateException
89 JalviewUserColours target = (JalviewUserColours) object;
90 return target.getSchemeName();
93 public void setValue(java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
98 JalviewUserColours target = (JalviewUserColours) object;
99 target.setSchemeName((java.lang.String) value);
100 } catch (java.lang.Exception ex)
102 throw new IllegalStateException(ex.toString());
106 public java.lang.Object newInstance(java.lang.Object parent)
111 desc.setHandler(handler);
112 desc.setMultivalued(false);
113 addFieldDescriptor(desc);
115 // -- validation code for: _schemeName
116 fieldValidator = new org.exolab.castor.xml.FieldValidator();
118 org.exolab.castor.xml.validators.StringValidator typeValidator;
119 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
120 fieldValidator.setValidator(typeValidator);
121 typeValidator.setWhiteSpace("preserve");
123 desc.setValidator(fieldValidator);
124 // -- initialize element descriptors
127 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
128 java.lang.String.class, "_version", "Version",
129 org.exolab.castor.xml.NodeType.Element);
130 desc.setImmutable(true);
131 handler = new org.exolab.castor.xml.XMLFieldHandler()
133 public java.lang.Object getValue(java.lang.Object object)
134 throws IllegalStateException
136 JalviewUserColours target = (JalviewUserColours) object;
137 return target.getVersion();
140 public void setValue(java.lang.Object object, java.lang.Object value)
141 throws IllegalStateException, IllegalArgumentException
145 JalviewUserColours target = (JalviewUserColours) object;
146 target.setVersion((java.lang.String) value);
147 } catch (java.lang.Exception ex)
149 throw new IllegalStateException(ex.toString());
153 public java.lang.Object newInstance(java.lang.Object parent)
158 desc.setHandler(handler);
159 desc.setMultivalued(false);
160 addFieldDescriptor(desc);
162 // -- validation code for: _version
163 fieldValidator = new org.exolab.castor.xml.FieldValidator();
165 org.exolab.castor.xml.validators.StringValidator typeValidator;
166 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
167 fieldValidator.setValidator(typeValidator);
168 typeValidator.setWhiteSpace("preserve");
170 desc.setValidator(fieldValidator);
172 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
173 Colour.class, "_colourList", "colour",
174 org.exolab.castor.xml.NodeType.Element);
175 handler = new org.exolab.castor.xml.XMLFieldHandler()
177 public java.lang.Object getValue(java.lang.Object object)
178 throws IllegalStateException
180 JalviewUserColours target = (JalviewUserColours) object;
181 return target.getColour();
184 public void setValue(java.lang.Object object, java.lang.Object value)
185 throws IllegalStateException, IllegalArgumentException
189 JalviewUserColours target = (JalviewUserColours) object;
190 target.addColour((Colour) value);
191 } catch (java.lang.Exception ex)
193 throw new IllegalStateException(ex.toString());
197 public void resetValue(Object object) throws IllegalStateException,
198 IllegalArgumentException
202 JalviewUserColours target = (JalviewUserColours) object;
203 target.removeAllColour();
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(true);
217 addFieldDescriptor(desc);
219 // -- validation code for: _colourList
220 fieldValidator = new org.exolab.castor.xml.FieldValidator();
221 fieldValidator.setMinOccurs(0);
224 desc.setValidator(fieldValidator);
232 * Method getAccessMode.
234 * @return the access mode specified for this class.
236 public org.exolab.castor.mapping.AccessMode getAccessMode()
242 * Method getIdentity.
244 * @return the identity field, null if this class has no identity.
246 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
248 return super.getIdentity();
252 * Method getJavaClass.
254 * @return the Java class represented by this descriptor.
256 public java.lang.Class getJavaClass()
258 return jalview.schemabinding.version2.JalviewUserColours.class;
262 * Method getNameSpacePrefix.
264 * @return the namespace prefix to use when marshaling as XML.
266 public java.lang.String getNameSpacePrefix()
272 * Method getNameSpaceURI.
274 * @return the namespace URI used when marshaling and unmarshaling as XML.
276 public java.lang.String getNameSpaceURI()
282 * Method getValidator.
284 * @return a specific validator for the class described by this
287 public org.exolab.castor.xml.TypeValidator getValidator()
295 * @return the XML Name for the Class being described.
297 public java.lang.String getXMLName()
303 * Method isElementDefinition.
305 * @return true if XML schema definition of this Class is that of a global
306 * element or element with anonymous type definition.
308 public boolean isElementDefinition()
310 return _elementDefinition;