a414789ed340cbd386117f90d0e7918ccd7218d8
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / CalcIdParamDescriptor.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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  */
18 package jalview.schemabinding.version2.descriptors;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import jalview.schemabinding.version2.CalcIdParam;
25
26 /**
27  * Class CalcIdParamDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class CalcIdParamDescriptor
32         extends
33         jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * Field _elementDefinition.
42    */
43   private boolean _elementDefinition;
44
45   /**
46    * Field _nsPrefix.
47    */
48   private java.lang.String _nsPrefix;
49
50   /**
51    * Field _nsURI.
52    */
53   private java.lang.String _nsURI;
54
55   /**
56    * Field _xmlName.
57    */
58   private java.lang.String _xmlName;
59
60   // ----------------/
61   // - Constructors -/
62   // ----------------/
63
64   public CalcIdParamDescriptor()
65   {
66     super();
67     setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
68     _nsURI = "www.jalview.org";
69     _xmlName = "calcIdParam";
70     _elementDefinition = true;
71     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
72     org.exolab.castor.mapping.FieldHandler handler = null;
73     org.exolab.castor.xml.FieldValidator fieldValidator = null;
74     // -- initialize attribute descriptors
75
76     // -- _calcId
77     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
78             java.lang.String.class, "_calcId", "calcId",
79             org.exolab.castor.xml.NodeType.Attribute);
80     desc.setImmutable(true);
81     handler = new org.exolab.castor.xml.XMLFieldHandler()
82     {
83       public java.lang.Object getValue(java.lang.Object object)
84               throws IllegalStateException
85       {
86         CalcIdParam target = (CalcIdParam) object;
87         return target.getCalcId();
88       }
89
90       public void setValue(java.lang.Object object, java.lang.Object value)
91               throws IllegalStateException, IllegalArgumentException
92       {
93         try
94         {
95           CalcIdParam target = (CalcIdParam) object;
96           target.setCalcId((java.lang.String) value);
97         } catch (java.lang.Exception ex)
98         {
99           throw new IllegalStateException(ex.toString());
100         }
101       }
102
103       public java.lang.Object newInstance(java.lang.Object parent)
104       {
105         return null;
106       }
107     };
108     desc.setHandler(handler);
109     desc.setRequired(true);
110     desc.setMultivalued(false);
111     addFieldDescriptor(desc);
112
113     // -- validation code for: _calcId
114     fieldValidator = new org.exolab.castor.xml.FieldValidator();
115     fieldValidator.setMinOccurs(1);
116     { // -- local scope
117       org.exolab.castor.xml.validators.StringValidator typeValidator;
118       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
119       fieldValidator.setValidator(typeValidator);
120       typeValidator.setWhiteSpace("preserve");
121     }
122     desc.setValidator(fieldValidator);
123     // -- _needsUpdate
124     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
125             java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate",
126             org.exolab.castor.xml.NodeType.Attribute);
127     handler = new org.exolab.castor.xml.XMLFieldHandler()
128     {
129       public java.lang.Object getValue(java.lang.Object object)
130               throws IllegalStateException
131       {
132         CalcIdParam target = (CalcIdParam) object;
133         if (!target.hasNeedsUpdate())
134         {
135           return null;
136         }
137         return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE
138                 : java.lang.Boolean.FALSE);
139       }
140
141       public void setValue(java.lang.Object object, java.lang.Object value)
142               throws IllegalStateException, IllegalArgumentException
143       {
144         try
145         {
146           CalcIdParam target = (CalcIdParam) object;
147           // if null, use delete method for optional primitives
148           if (value == null)
149           {
150             target.deleteNeedsUpdate();
151             return;
152           }
153           target.setNeedsUpdate(((java.lang.Boolean) value).booleanValue());
154         } catch (java.lang.Exception ex)
155         {
156           throw new IllegalStateException(ex.toString());
157         }
158       }
159
160       public java.lang.Object newInstance(java.lang.Object parent)
161       {
162         return null;
163       }
164     };
165     desc.setHandler(handler);
166     desc.setMultivalued(false);
167     addFieldDescriptor(desc);
168
169     // -- validation code for: _needsUpdate
170     fieldValidator = new org.exolab.castor.xml.FieldValidator();
171     { // -- local scope
172       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
173       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
174       fieldValidator.setValidator(typeValidator);
175     }
176     desc.setValidator(fieldValidator);
177     // -- _autoUpdate
178     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
179             java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate",
180             org.exolab.castor.xml.NodeType.Attribute);
181     handler = new org.exolab.castor.xml.XMLFieldHandler()
182     {
183       public java.lang.Object getValue(java.lang.Object object)
184               throws IllegalStateException
185       {
186         CalcIdParam target = (CalcIdParam) object;
187         if (!target.hasAutoUpdate())
188         {
189           return null;
190         }
191         return (target.getAutoUpdate() ? java.lang.Boolean.TRUE
192                 : java.lang.Boolean.FALSE);
193       }
194
195       public void setValue(java.lang.Object object, java.lang.Object value)
196               throws IllegalStateException, IllegalArgumentException
197       {
198         try
199         {
200           CalcIdParam target = (CalcIdParam) object;
201           // ignore null values for non optional primitives
202           if (value == null)
203           {
204             return;
205           }
206
207           target.setAutoUpdate(((java.lang.Boolean) value).booleanValue());
208         } catch (java.lang.Exception ex)
209         {
210           throw new IllegalStateException(ex.toString());
211         }
212       }
213
214       public java.lang.Object newInstance(java.lang.Object parent)
215       {
216         return null;
217       }
218     };
219     desc.setHandler(handler);
220     desc.setRequired(true);
221     desc.setMultivalued(false);
222     addFieldDescriptor(desc);
223
224     // -- validation code for: _autoUpdate
225     fieldValidator = new org.exolab.castor.xml.FieldValidator();
226     fieldValidator.setMinOccurs(1);
227     { // -- local scope
228       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
229       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
230       fieldValidator.setValidator(typeValidator);
231     }
232     desc.setValidator(fieldValidator);
233     // -- initialize element descriptors
234
235   }
236
237   // -----------/
238   // - Methods -/
239   // -----------/
240
241   /**
242    * Method getAccessMode.
243    * 
244    * @return the access mode specified for this class.
245    */
246   public org.exolab.castor.mapping.AccessMode getAccessMode()
247   {
248     return null;
249   }
250
251   /**
252    * Method getIdentity.
253    * 
254    * @return the identity field, null if this class has no identity.
255    */
256   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
257   {
258     return super.getIdentity();
259   }
260
261   /**
262    * Method getJavaClass.
263    * 
264    * @return the Java class represented by this descriptor.
265    */
266   public java.lang.Class getJavaClass()
267   {
268     return jalview.schemabinding.version2.CalcIdParam.class;
269   }
270
271   /**
272    * Method getNameSpacePrefix.
273    * 
274    * @return the namespace prefix to use when marshaling as XML.
275    */
276   public java.lang.String getNameSpacePrefix()
277   {
278     return _nsPrefix;
279   }
280
281   /**
282    * Method getNameSpaceURI.
283    * 
284    * @return the namespace URI used when marshaling and unmarshaling as XML.
285    */
286   public java.lang.String getNameSpaceURI()
287   {
288     return _nsURI;
289   }
290
291   /**
292    * Method getValidator.
293    * 
294    * @return a specific validator for the class described by this
295    *         ClassDescriptor.
296    */
297   public org.exolab.castor.xml.TypeValidator getValidator()
298   {
299     return this;
300   }
301
302   /**
303    * Method getXMLName.
304    * 
305    * @return the XML Name for the Class being described.
306    */
307   public java.lang.String getXMLName()
308   {
309     return _xmlName;
310   }
311
312   /**
313    * Method isElementDefinition.
314    * 
315    * @return true if XML schema definition of this Class is that of a global
316    *         element or element with anonymous type definition.
317    */
318   public boolean isElementDefinition()
319   {
320     return _elementDefinition;
321   }
322
323 }