1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.Colour;
32 import jalview.schemabinding.version2.JalviewUserColours;
35 * Class JalviewUserColoursDescriptor.
37 * @version $Revision$ $Date$
39 public class JalviewUserColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
47 * Field _elementDefinition.
49 private boolean _elementDefinition;
54 private java.lang.String _nsPrefix;
59 private java.lang.String _nsURI;
64 private java.lang.String _xmlName;
71 public JalviewUserColoursDescriptor() {
73 _nsURI = "www.jalview.org/colours";
74 _xmlName = "JalviewUserColours";
75 _elementDefinition = false;
77 //-- set grouping compositor
78 setCompositorAsSequence();
79 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
80 org.exolab.castor.mapping.FieldHandler handler = null;
81 org.exolab.castor.xml.FieldValidator fieldValidator = null;
82 //-- initialize attribute descriptors
85 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_schemeName", "schemeName", org.exolab.castor.xml.NodeType.Attribute);
86 desc.setImmutable(true);
87 handler = new org.exolab.castor.xml.XMLFieldHandler() {
88 public java.lang.Object getValue( java.lang.Object object )
89 throws IllegalStateException
91 JalviewUserColours target = (JalviewUserColours) object;
92 return target.getSchemeName();
94 public void setValue( java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
98 JalviewUserColours target = (JalviewUserColours) object;
99 target.setSchemeName( (java.lang.String) value);
100 } catch (java.lang.Exception ex) {
101 throw new IllegalStateException(ex.toString());
104 public java.lang.Object newInstance(java.lang.Object parent) {
108 desc.setHandler(handler);
109 desc.setMultivalued(false);
110 addFieldDescriptor(desc);
112 //-- validation code for: _schemeName
113 fieldValidator = new org.exolab.castor.xml.FieldValidator();
115 org.exolab.castor.xml.validators.StringValidator typeValidator;
116 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
117 fieldValidator.setValidator(typeValidator);
118 typeValidator.setWhiteSpace("preserve");
120 desc.setValidator(fieldValidator);
121 //-- initialize element descriptors
124 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element);
125 desc.setImmutable(true);
126 handler = new org.exolab.castor.xml.XMLFieldHandler() {
127 public java.lang.Object getValue( java.lang.Object object )
128 throws IllegalStateException
130 JalviewUserColours target = (JalviewUserColours) object;
131 return target.getVersion();
133 public void setValue( java.lang.Object object, java.lang.Object value)
134 throws IllegalStateException, IllegalArgumentException
137 JalviewUserColours target = (JalviewUserColours) object;
138 target.setVersion( (java.lang.String) value);
139 } catch (java.lang.Exception ex) {
140 throw new IllegalStateException(ex.toString());
143 public java.lang.Object newInstance(java.lang.Object parent) {
147 desc.setHandler(handler);
148 desc.setMultivalued(false);
149 addFieldDescriptor(desc);
151 //-- validation code for: _version
152 fieldValidator = new org.exolab.castor.xml.FieldValidator();
154 org.exolab.castor.xml.validators.StringValidator typeValidator;
155 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
156 fieldValidator.setValidator(typeValidator);
157 typeValidator.setWhiteSpace("preserve");
159 desc.setValidator(fieldValidator);
161 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(Colour.class, "_colourList", "colour", org.exolab.castor.xml.NodeType.Element);
162 handler = new org.exolab.castor.xml.XMLFieldHandler() {
163 public java.lang.Object getValue( java.lang.Object object )
164 throws IllegalStateException
166 JalviewUserColours target = (JalviewUserColours) object;
167 return target.getColour();
169 public void setValue( java.lang.Object object, java.lang.Object value)
170 throws IllegalStateException, IllegalArgumentException
173 JalviewUserColours target = (JalviewUserColours) object;
174 target.addColour( (Colour) value);
175 } catch (java.lang.Exception ex) {
176 throw new IllegalStateException(ex.toString());
179 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
181 JalviewUserColours target = (JalviewUserColours) object;
182 target.removeAllColour();
183 } catch (java.lang.Exception ex) {
184 throw new IllegalStateException(ex.toString());
187 public java.lang.Object newInstance(java.lang.Object parent) {
191 desc.setHandler(handler);
192 desc.setMultivalued(true);
193 addFieldDescriptor(desc);
195 //-- validation code for: _colourList
196 fieldValidator = new org.exolab.castor.xml.FieldValidator();
197 fieldValidator.setMinOccurs(0);
200 desc.setValidator(fieldValidator);
209 * Method getAccessMode.
211 * @return the access mode specified for this class.
213 public org.exolab.castor.mapping.AccessMode getAccessMode(
219 * Method getIdentity.
221 * @return the identity field, null if this class has no
224 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
226 return super.getIdentity();
230 * Method getJavaClass.
232 * @return the Java class represented by this descriptor.
234 public java.lang.Class getJavaClass(
236 return jalview.schemabinding.version2.JalviewUserColours.class;
240 * Method getNameSpacePrefix.
242 * @return the namespace prefix to use when marshaling as XML.
244 public java.lang.String getNameSpacePrefix(
250 * Method getNameSpaceURI.
252 * @return the namespace URI used when marshaling and
253 * unmarshaling as XML.
255 public java.lang.String getNameSpaceURI(
261 * Method getValidator.
263 * @return a specific validator for the class described by this
266 public org.exolab.castor.xml.TypeValidator getValidator(
274 * @return the XML Name for the Class being described.
276 public java.lang.String getXMLName(
282 * Method isElementDefinition.
284 * @return true if XML schema definition of this Class is that
286 * element or element with anonymous type definition.
288 public boolean isElementDefinition(
290 return _elementDefinition;