c70f679c33a6dbe4662a29f623b61ba6b328ec57
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / JalviewUserColoursDescriptor.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  
17  * If not, see <http://www.gnu.org/licenses/>.
18  * The Jalview Authors are detailed in the 'AUTHORS' file.
19  ******************************************************************************/
20 /*
21  * This class was automatically generated with 
22  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
23  * Schema.
24  * $Id$
25  */
26
27 package jalview.schemabinding.version2.descriptors;
28
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
32
33 import jalview.schemabinding.version2.Colour;
34 import jalview.schemabinding.version2.JalviewUserColours;
35
36 /**
37  * Class JalviewUserColoursDescriptor.
38  * 
39  * @version $Revision$ $Date$
40  */
41 public class JalviewUserColoursDescriptor extends
42         org.exolab.castor.xml.util.XMLClassDescriptorImpl
43 {
44
45   // --------------------------/
46   // - Class/Member Variables -/
47   // --------------------------/
48
49   /**
50    * Field _elementDefinition.
51    */
52   private boolean _elementDefinition;
53
54   /**
55    * Field _nsPrefix.
56    */
57   private java.lang.String _nsPrefix;
58
59   /**
60    * Field _nsURI.
61    */
62   private java.lang.String _nsURI;
63
64   /**
65    * Field _xmlName.
66    */
67   private java.lang.String _xmlName;
68
69   // ----------------/
70   // - Constructors -/
71   // ----------------/
72
73   public JalviewUserColoursDescriptor()
74   {
75     super();
76     _nsURI = "www.jalview.org/colours";
77     _xmlName = "JalviewUserColours";
78     _elementDefinition = false;
79
80     // -- set grouping compositor
81     setCompositorAsSequence();
82     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
83     org.exolab.castor.mapping.FieldHandler handler = null;
84     org.exolab.castor.xml.FieldValidator fieldValidator = null;
85     // -- initialize attribute descriptors
86
87     // -- _schemeName
88     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
89             java.lang.String.class, "_schemeName", "schemeName",
90             org.exolab.castor.xml.NodeType.Attribute);
91     desc.setImmutable(true);
92     handler = new org.exolab.castor.xml.XMLFieldHandler()
93     {
94       public java.lang.Object getValue(java.lang.Object object)
95               throws IllegalStateException
96       {
97         JalviewUserColours target = (JalviewUserColours) object;
98         return target.getSchemeName();
99       }
100
101       public void setValue(java.lang.Object object, java.lang.Object value)
102               throws IllegalStateException, IllegalArgumentException
103       {
104         try
105         {
106           JalviewUserColours target = (JalviewUserColours) object;
107           target.setSchemeName((java.lang.String) value);
108         } catch (java.lang.Exception ex)
109         {
110           throw new IllegalStateException(ex.toString());
111         }
112       }
113
114       public java.lang.Object newInstance(java.lang.Object parent)
115       {
116         return null;
117       }
118     };
119     desc.setHandler(handler);
120     desc.setMultivalued(false);
121     addFieldDescriptor(desc);
122
123     // -- validation code for: _schemeName
124     fieldValidator = new org.exolab.castor.xml.FieldValidator();
125     { // -- local scope
126       org.exolab.castor.xml.validators.StringValidator typeValidator;
127       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
128       fieldValidator.setValidator(typeValidator);
129       typeValidator.setWhiteSpace("preserve");
130     }
131     desc.setValidator(fieldValidator);
132     // -- initialize element descriptors
133
134     // -- _version
135     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
136             java.lang.String.class, "_version", "Version",
137             org.exolab.castor.xml.NodeType.Element);
138     desc.setImmutable(true);
139     handler = new org.exolab.castor.xml.XMLFieldHandler()
140     {
141       public java.lang.Object getValue(java.lang.Object object)
142               throws IllegalStateException
143       {
144         JalviewUserColours target = (JalviewUserColours) object;
145         return target.getVersion();
146       }
147
148       public void setValue(java.lang.Object object, java.lang.Object value)
149               throws IllegalStateException, IllegalArgumentException
150       {
151         try
152         {
153           JalviewUserColours target = (JalviewUserColours) object;
154           target.setVersion((java.lang.String) value);
155         } catch (java.lang.Exception ex)
156         {
157           throw new IllegalStateException(ex.toString());
158         }
159       }
160
161       public java.lang.Object newInstance(java.lang.Object parent)
162       {
163         return null;
164       }
165     };
166     desc.setHandler(handler);
167     desc.setMultivalued(false);
168     addFieldDescriptor(desc);
169
170     // -- validation code for: _version
171     fieldValidator = new org.exolab.castor.xml.FieldValidator();
172     { // -- local scope
173       org.exolab.castor.xml.validators.StringValidator typeValidator;
174       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
175       fieldValidator.setValidator(typeValidator);
176       typeValidator.setWhiteSpace("preserve");
177     }
178     desc.setValidator(fieldValidator);
179     // -- _colourList
180     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
181             Colour.class, "_colourList", "colour",
182             org.exolab.castor.xml.NodeType.Element);
183     handler = new org.exolab.castor.xml.XMLFieldHandler()
184     {
185       public java.lang.Object getValue(java.lang.Object object)
186               throws IllegalStateException
187       {
188         JalviewUserColours target = (JalviewUserColours) object;
189         return target.getColour();
190       }
191
192       public void setValue(java.lang.Object object, java.lang.Object value)
193               throws IllegalStateException, IllegalArgumentException
194       {
195         try
196         {
197           JalviewUserColours target = (JalviewUserColours) object;
198           target.addColour((Colour) value);
199         } catch (java.lang.Exception ex)
200         {
201           throw new IllegalStateException(ex.toString());
202         }
203       }
204
205       public void resetValue(Object object) throws IllegalStateException,
206               IllegalArgumentException
207       {
208         try
209         {
210           JalviewUserColours target = (JalviewUserColours) object;
211           target.removeAllColour();
212         } catch (java.lang.Exception ex)
213         {
214           throw new IllegalStateException(ex.toString());
215         }
216       }
217
218       public java.lang.Object newInstance(java.lang.Object parent)
219       {
220         return new Colour();
221       }
222     };
223     desc.setHandler(handler);
224     desc.setMultivalued(true);
225     addFieldDescriptor(desc);
226
227     // -- validation code for: _colourList
228     fieldValidator = new org.exolab.castor.xml.FieldValidator();
229     fieldValidator.setMinOccurs(0);
230     { // -- local scope
231     }
232     desc.setValidator(fieldValidator);
233   }
234
235   // -----------/
236   // - Methods -/
237   // -----------/
238
239   /**
240    * Method getAccessMode.
241    * 
242    * @return the access mode specified for this class.
243    */
244   public org.exolab.castor.mapping.AccessMode getAccessMode()
245   {
246     return null;
247   }
248
249   /**
250    * Method getIdentity.
251    * 
252    * @return the identity field, null if this class has no identity.
253    */
254   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
255   {
256     return super.getIdentity();
257   }
258
259   /**
260    * Method getJavaClass.
261    * 
262    * @return the Java class represented by this descriptor.
263    */
264   public java.lang.Class getJavaClass()
265   {
266     return jalview.schemabinding.version2.JalviewUserColours.class;
267   }
268
269   /**
270    * Method getNameSpacePrefix.
271    * 
272    * @return the namespace prefix to use when marshaling as XML.
273    */
274   public java.lang.String getNameSpacePrefix()
275   {
276     return _nsPrefix;
277   }
278
279   /**
280    * Method getNameSpaceURI.
281    * 
282    * @return the namespace URI used when marshaling and unmarshaling as XML.
283    */
284   public java.lang.String getNameSpaceURI()
285   {
286     return _nsURI;
287   }
288
289   /**
290    * Method getValidator.
291    * 
292    * @return a specific validator for the class described by this
293    *         ClassDescriptor.
294    */
295   public org.exolab.castor.xml.TypeValidator getValidator()
296   {
297     return this;
298   }
299
300   /**
301    * Method getXMLName.
302    * 
303    * @return the XML Name for the Class being described.
304    */
305   public java.lang.String getXMLName()
306   {
307     return _xmlName;
308   }
309
310   /**
311    * Method isElementDefinition.
312    * 
313    * @return true if XML schema definition of this Class is that of a global
314    *         element or element with anonymous type definition.
315    */
316   public boolean isElementDefinition()
317   {
318     return _elementDefinition;
319   }
320
321 }