b7826d048475f7f01172ae1214b9a3fcf2175267
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / SequenceTypeDescriptor.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.SequenceType;
25
26 /**
27  * Class SequenceTypeDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class SequenceTypeDescriptor extends
32         org.exolab.castor.xml.util.XMLClassDescriptorImpl
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _elementDefinition.
41    */
42   private boolean _elementDefinition;
43
44   /**
45    * Field _nsPrefix.
46    */
47   private java.lang.String _nsPrefix;
48
49   /**
50    * Field _nsURI.
51    */
52   private java.lang.String _nsURI;
53
54   /**
55    * Field _xmlName.
56    */
57   private java.lang.String _xmlName;
58
59   // ----------------/
60   // - Constructors -/
61   // ----------------/
62
63   public SequenceTypeDescriptor()
64   {
65     super();
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";
67     _xmlName = "SequenceType";
68     _elementDefinition = false;
69
70     // -- set grouping compositor
71     setCompositorAsSequence();
72     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
73     org.exolab.castor.mapping.FieldHandler handler = null;
74     org.exolab.castor.xml.FieldValidator fieldValidator = null;
75     // -- initialize attribute descriptors
76
77     // -- _id
78     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
79             java.lang.String.class, "_id", "id",
80             org.exolab.castor.xml.NodeType.Attribute);
81     desc.setImmutable(true);
82     handler = new org.exolab.castor.xml.XMLFieldHandler()
83     {
84       public java.lang.Object getValue(java.lang.Object object)
85               throws IllegalStateException
86       {
87         SequenceType target = (SequenceType) object;
88         return target.getId();
89       }
90
91       public void setValue(java.lang.Object object, java.lang.Object value)
92               throws IllegalStateException, IllegalArgumentException
93       {
94         try
95         {
96           SequenceType target = (SequenceType) object;
97           target.setId((java.lang.String) value);
98         } catch (java.lang.Exception ex)
99         {
100           throw new IllegalStateException(ex.toString());
101         }
102       }
103
104       public java.lang.Object newInstance(java.lang.Object parent)
105       {
106         return null;
107       }
108     };
109     desc.setHandler(handler);
110     desc.setMultivalued(false);
111     addFieldDescriptor(desc);
112
113     // -- validation code for: _id
114     fieldValidator = new org.exolab.castor.xml.FieldValidator();
115     { // -- local scope
116       org.exolab.castor.xml.validators.StringValidator typeValidator;
117       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
118       fieldValidator.setValidator(typeValidator);
119       typeValidator.setWhiteSpace("preserve");
120     }
121     desc.setValidator(fieldValidator);
122     // -- _description
123     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
124             java.lang.String.class, "_description", "description",
125             org.exolab.castor.xml.NodeType.Attribute);
126     desc.setImmutable(true);
127     handler = new org.exolab.castor.xml.XMLFieldHandler()
128     {
129       public java.lang.Object getValue(java.lang.Object object)
130               throws IllegalStateException
131       {
132         SequenceType target = (SequenceType) object;
133         return target.getDescription();
134       }
135
136       public void setValue(java.lang.Object object, java.lang.Object value)
137               throws IllegalStateException, IllegalArgumentException
138       {
139         try
140         {
141           SequenceType target = (SequenceType) object;
142           target.setDescription((java.lang.String) value);
143         } catch (java.lang.Exception ex)
144         {
145           throw new IllegalStateException(ex.toString());
146         }
147       }
148
149       public java.lang.Object newInstance(java.lang.Object parent)
150       {
151         return null;
152       }
153     };
154     desc.setHandler(handler);
155     desc.setMultivalued(false);
156     addFieldDescriptor(desc);
157
158     // -- validation code for: _description
159     fieldValidator = new org.exolab.castor.xml.FieldValidator();
160     { // -- local scope
161       org.exolab.castor.xml.validators.StringValidator typeValidator;
162       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
163       fieldValidator.setValidator(typeValidator);
164       typeValidator.setWhiteSpace("preserve");
165     }
166     desc.setValidator(fieldValidator);
167     // -- initialize element descriptors
168
169     // -- _sequence
170     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
171             java.lang.String.class, "_sequence", "sequence",
172             org.exolab.castor.xml.NodeType.Element);
173     desc.setImmutable(true);
174     handler = new org.exolab.castor.xml.XMLFieldHandler()
175     {
176       public java.lang.Object getValue(java.lang.Object object)
177               throws IllegalStateException
178       {
179         SequenceType target = (SequenceType) object;
180         return target.getSequence();
181       }
182
183       public void setValue(java.lang.Object object, java.lang.Object value)
184               throws IllegalStateException, IllegalArgumentException
185       {
186         try
187         {
188           SequenceType target = (SequenceType) object;
189           target.setSequence((java.lang.String) value);
190         } catch (java.lang.Exception ex)
191         {
192           throw new IllegalStateException(ex.toString());
193         }
194       }
195
196       public java.lang.Object newInstance(java.lang.Object parent)
197       {
198         return null;
199       }
200     };
201     desc.setHandler(handler);
202     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
203     desc.setMultivalued(false);
204     addFieldDescriptor(desc);
205
206     // -- validation code for: _sequence
207     fieldValidator = new org.exolab.castor.xml.FieldValidator();
208     { // -- local scope
209       org.exolab.castor.xml.validators.StringValidator typeValidator;
210       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
211       fieldValidator.setValidator(typeValidator);
212       typeValidator.setWhiteSpace("preserve");
213     }
214     desc.setValidator(fieldValidator);
215     // -- _name
216     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
217             java.lang.String.class, "_name", "name",
218             org.exolab.castor.xml.NodeType.Element);
219     desc.setImmutable(true);
220     handler = new org.exolab.castor.xml.XMLFieldHandler()
221     {
222       public java.lang.Object getValue(java.lang.Object object)
223               throws IllegalStateException
224       {
225         SequenceType target = (SequenceType) object;
226         return target.getName();
227       }
228
229       public void setValue(java.lang.Object object, java.lang.Object value)
230               throws IllegalStateException, IllegalArgumentException
231       {
232         try
233         {
234           SequenceType target = (SequenceType) object;
235           target.setName((java.lang.String) value);
236         } catch (java.lang.Exception ex)
237         {
238           throw new IllegalStateException(ex.toString());
239         }
240       }
241
242       public java.lang.Object newInstance(java.lang.Object parent)
243       {
244         return null;
245       }
246     };
247     desc.setHandler(handler);
248     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
249     desc.setMultivalued(false);
250     addFieldDescriptor(desc);
251
252     // -- validation code for: _name
253     fieldValidator = new org.exolab.castor.xml.FieldValidator();
254     { // -- local scope
255       org.exolab.castor.xml.validators.StringValidator typeValidator;
256       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
257       fieldValidator.setValidator(typeValidator);
258       typeValidator.setWhiteSpace("preserve");
259     }
260     desc.setValidator(fieldValidator);
261   }
262
263   // -----------/
264   // - Methods -/
265   // -----------/
266
267   /**
268    * Method getAccessMode.
269    * 
270    * @return the access mode specified for this class.
271    */
272   public org.exolab.castor.mapping.AccessMode getAccessMode()
273   {
274     return null;
275   }
276
277   /**
278    * Method getIdentity.
279    * 
280    * @return the identity field, null if this class has no identity.
281    */
282   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
283   {
284     return super.getIdentity();
285   }
286
287   /**
288    * Method getJavaClass.
289    * 
290    * @return the Java class represented by this descriptor.
291    */
292   public java.lang.Class getJavaClass()
293   {
294     return jalview.schemabinding.version2.SequenceType.class;
295   }
296
297   /**
298    * Method getNameSpacePrefix.
299    * 
300    * @return the namespace prefix to use when marshaling as XML.
301    */
302   public java.lang.String getNameSpacePrefix()
303   {
304     return _nsPrefix;
305   }
306
307   /**
308    * Method getNameSpaceURI.
309    * 
310    * @return the namespace URI used when marshaling and unmarshaling as XML.
311    */
312   public java.lang.String getNameSpaceURI()
313   {
314     return _nsURI;
315   }
316
317   /**
318    * Method getValidator.
319    * 
320    * @return a specific validator for the class described by this
321    *         ClassDescriptor.
322    */
323   public org.exolab.castor.xml.TypeValidator getValidator()
324   {
325     return this;
326   }
327
328   /**
329    * Method getXMLName.
330    * 
331    * @return the XML Name for the Class being described.
332    */
333   public java.lang.String getXMLName()
334   {
335     return _xmlName;
336   }
337
338   /**
339    * Method isElementDefinition.
340    * 
341    * @return true if XML schema definition of this Class is that of a global
342    *         element or element with anonymous type definition.
343    */
344   public boolean isElementDefinition()
345   {
346     return _elementDefinition;
347   }
348
349 }