966f5320c713fce9dea24af0f0910af3d11ab3bd
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / VAMSASDescriptor.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.VAMSAS;
25
26 /**
27  * Class VAMSASDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class VAMSASDescriptor 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 VAMSASDescriptor()
64   {
65     super();
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";
67     _xmlName = "VAMSAS";
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     // -- initialize element descriptors
78
79     // -- _treeList
80     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
81             java.lang.String.class, "_treeList", "Tree",
82             org.exolab.castor.xml.NodeType.Element);
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         VAMSAS target = (VAMSAS) object;
90         return target.getTree();
91       }
92
93       public void setValue(java.lang.Object object, java.lang.Object value)
94               throws IllegalStateException, IllegalArgumentException
95       {
96         try
97         {
98           VAMSAS target = (VAMSAS) object;
99           target.addTree((java.lang.String) value);
100         } catch (java.lang.Exception ex)
101         {
102           throw new IllegalStateException(ex.toString());
103         }
104       }
105
106       public void resetValue(Object object) throws IllegalStateException,
107               IllegalArgumentException
108       {
109         try
110         {
111           VAMSAS target = (VAMSAS) object;
112           target.removeAllTree();
113         } catch (java.lang.Exception ex)
114         {
115           throw new IllegalStateException(ex.toString());
116         }
117       }
118
119       public java.lang.Object newInstance(java.lang.Object parent)
120       {
121         return null;
122       }
123     };
124     desc.setHandler(handler);
125     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
126     desc.setMultivalued(true);
127     addFieldDescriptor(desc);
128
129     // -- validation code for: _treeList
130     fieldValidator = new org.exolab.castor.xml.FieldValidator();
131     fieldValidator.setMinOccurs(0);
132     { // -- local scope
133       org.exolab.castor.xml.validators.StringValidator typeValidator;
134       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
135       fieldValidator.setValidator(typeValidator);
136       typeValidator.setWhiteSpace("preserve");
137     }
138     desc.setValidator(fieldValidator);
139     // -- _sequenceSetList
140     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
141             jalview.schemabinding.version2.SequenceSet.class,
142             "_sequenceSetList", "SequenceSet",
143             org.exolab.castor.xml.NodeType.Element);
144     handler = new org.exolab.castor.xml.XMLFieldHandler()
145     {
146       public java.lang.Object getValue(java.lang.Object object)
147               throws IllegalStateException
148       {
149         VAMSAS target = (VAMSAS) object;
150         return target.getSequenceSet();
151       }
152
153       public void setValue(java.lang.Object object, java.lang.Object value)
154               throws IllegalStateException, IllegalArgumentException
155       {
156         try
157         {
158           VAMSAS target = (VAMSAS) object;
159           target.addSequenceSet((jalview.schemabinding.version2.SequenceSet) value);
160         } catch (java.lang.Exception ex)
161         {
162           throw new IllegalStateException(ex.toString());
163         }
164       }
165
166       public void resetValue(Object object) throws IllegalStateException,
167               IllegalArgumentException
168       {
169         try
170         {
171           VAMSAS target = (VAMSAS) object;
172           target.removeAllSequenceSet();
173         } catch (java.lang.Exception ex)
174         {
175           throw new IllegalStateException(ex.toString());
176         }
177       }
178
179       public java.lang.Object newInstance(java.lang.Object parent)
180       {
181         return new jalview.schemabinding.version2.SequenceSet();
182       }
183     };
184     desc.setHandler(handler);
185     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
186     desc.setMultivalued(true);
187     addFieldDescriptor(desc);
188
189     // -- validation code for: _sequenceSetList
190     fieldValidator = new org.exolab.castor.xml.FieldValidator();
191     fieldValidator.setMinOccurs(0);
192     { // -- local scope
193     }
194     desc.setValidator(fieldValidator);
195   }
196
197   // -----------/
198   // - Methods -/
199   // -----------/
200
201   /**
202    * Method getAccessMode.
203    * 
204    * @return the access mode specified for this class.
205    */
206   public org.exolab.castor.mapping.AccessMode getAccessMode()
207   {
208     return null;
209   }
210
211   /**
212    * Method getIdentity.
213    * 
214    * @return the identity field, null if this class has no identity.
215    */
216   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
217   {
218     return super.getIdentity();
219   }
220
221   /**
222    * Method getJavaClass.
223    * 
224    * @return the Java class represented by this descriptor.
225    */
226   public java.lang.Class getJavaClass()
227   {
228     return jalview.schemabinding.version2.VAMSAS.class;
229   }
230
231   /**
232    * Method getNameSpacePrefix.
233    * 
234    * @return the namespace prefix to use when marshaling as XML.
235    */
236   public java.lang.String getNameSpacePrefix()
237   {
238     return _nsPrefix;
239   }
240
241   /**
242    * Method getNameSpaceURI.
243    * 
244    * @return the namespace URI used when marshaling and unmarshaling as XML.
245    */
246   public java.lang.String getNameSpaceURI()
247   {
248     return _nsURI;
249   }
250
251   /**
252    * Method getValidator.
253    * 
254    * @return a specific validator for the class described by this
255    *         ClassDescriptor.
256    */
257   public org.exolab.castor.xml.TypeValidator getValidator()
258   {
259     return this;
260   }
261
262   /**
263    * Method getXMLName.
264    * 
265    * @return the XML Name for the Class being described.
266    */
267   public java.lang.String getXMLName()
268   {
269     return _xmlName;
270   }
271
272   /**
273    * Method isElementDefinition.
274    * 
275    * @return true if XML schema definition of this Class is that of a global
276    *         element or element with anonymous type definition.
277    */
278   public boolean isElementDefinition()
279   {
280     return _elementDefinition;
281   }
282
283 }