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