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