0dad270034c0df0cc755cb2b363e4868ac8993e7
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / GroupDescriptor.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.  
17  * If not, see <http://www.gnu.org/licenses/>.
18  * The Jalview Authors are detailed in the 'AUTHORS' file.
19  ******************************************************************************/
20 /*
21  * This class was automatically generated with 
22  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
23  * Schema.
24  * $Id$
25  */
26
27 package jalview.schemabinding.version2.descriptors;
28
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
32
33 import jalview.schemabinding.version2.Group;
34
35 /**
36  * Class GroupDescriptor.
37  * 
38  * @version $Revision$ $Date$
39  */
40 public class GroupDescriptor extends
41         org.exolab.castor.xml.util.XMLClassDescriptorImpl
42 {
43
44   // --------------------------/
45   // - Class/Member Variables -/
46   // --------------------------/
47
48   /**
49    * Field _elementDefinition.
50    */
51   private boolean _elementDefinition;
52
53   /**
54    * Field _nsPrefix.
55    */
56   private java.lang.String _nsPrefix;
57
58   /**
59    * Field _nsURI.
60    */
61   private java.lang.String _nsURI;
62
63   /**
64    * Field _xmlName.
65    */
66   private java.lang.String _xmlName;
67
68   // ----------------/
69   // - Constructors -/
70   // ----------------/
71
72   public GroupDescriptor()
73   {
74     super();
75     _nsURI = "www.jalview.org";
76     _xmlName = "group";
77     _elementDefinition = true;
78     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79     org.exolab.castor.mapping.FieldHandler handler = null;
80     org.exolab.castor.xml.FieldValidator fieldValidator = null;
81     // -- initialize attribute descriptors
82
83     // -- _name
84     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
85             java.lang.String.class, "_name", "name",
86             org.exolab.castor.xml.NodeType.Attribute);
87     desc.setImmutable(true);
88     handler = new org.exolab.castor.xml.XMLFieldHandler()
89     {
90       public java.lang.Object getValue(java.lang.Object object)
91               throws IllegalStateException
92       {
93         Group target = (Group) object;
94         return target.getName();
95       }
96
97       public void setValue(java.lang.Object object, java.lang.Object value)
98               throws IllegalStateException, IllegalArgumentException
99       {
100         try
101         {
102           Group target = (Group) object;
103           target.setName((java.lang.String) value);
104         } catch (java.lang.Exception ex)
105         {
106           throw new IllegalStateException(ex.toString());
107         }
108       }
109
110       public java.lang.Object newInstance(java.lang.Object parent)
111       {
112         return null;
113       }
114     };
115     desc.setHandler(handler);
116     desc.setRequired(true);
117     desc.setMultivalued(false);
118     addFieldDescriptor(desc);
119
120     // -- validation code for: _name
121     fieldValidator = new org.exolab.castor.xml.FieldValidator();
122     fieldValidator.setMinOccurs(1);
123     { // -- local scope
124       org.exolab.castor.xml.validators.StringValidator typeValidator;
125       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
126       fieldValidator.setValidator(typeValidator);
127       typeValidator.setWhiteSpace("preserve");
128     }
129     desc.setValidator(fieldValidator);
130     // -- _display
131     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
132             java.lang.Boolean.TYPE, "_display", "display",
133             org.exolab.castor.xml.NodeType.Attribute);
134     handler = new org.exolab.castor.xml.XMLFieldHandler()
135     {
136       public java.lang.Object getValue(java.lang.Object object)
137               throws IllegalStateException
138       {
139         Group target = (Group) object;
140         if (!target.hasDisplay())
141         {
142           return null;
143         }
144         return (target.getDisplay() ? java.lang.Boolean.TRUE
145                 : java.lang.Boolean.FALSE);
146       }
147
148       public void setValue(java.lang.Object object, java.lang.Object value)
149               throws IllegalStateException, IllegalArgumentException
150       {
151         try
152         {
153           Group target = (Group) object;
154           // ignore null values for non optional primitives
155           if (value == null)
156           {
157             return;
158           }
159
160           target.setDisplay(((java.lang.Boolean) value).booleanValue());
161         } catch (java.lang.Exception ex)
162         {
163           throw new IllegalStateException(ex.toString());
164         }
165       }
166
167       public java.lang.Object newInstance(java.lang.Object parent)
168       {
169         return null;
170       }
171     };
172     desc.setHandler(handler);
173     desc.setRequired(true);
174     desc.setMultivalued(false);
175     addFieldDescriptor(desc);
176
177     // -- validation code for: _display
178     fieldValidator = new org.exolab.castor.xml.FieldValidator();
179     fieldValidator.setMinOccurs(1);
180     { // -- local scope
181       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
182       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
183       fieldValidator.setValidator(typeValidator);
184     }
185     desc.setValidator(fieldValidator);
186     // -- initialize element descriptors
187
188   }
189
190   // -----------/
191   // - Methods -/
192   // -----------/
193
194   /**
195    * Method getAccessMode.
196    * 
197    * @return the access mode specified for this class.
198    */
199   public org.exolab.castor.mapping.AccessMode getAccessMode()
200   {
201     return null;
202   }
203
204   /**
205    * Method getIdentity.
206    * 
207    * @return the identity field, null if this class has no identity.
208    */
209   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
210   {
211     return super.getIdentity();
212   }
213
214   /**
215    * Method getJavaClass.
216    * 
217    * @return the Java class represented by this descriptor.
218    */
219   public java.lang.Class getJavaClass()
220   {
221     return jalview.schemabinding.version2.Group.class;
222   }
223
224   /**
225    * Method getNameSpacePrefix.
226    * 
227    * @return the namespace prefix to use when marshaling as XML.
228    */
229   public java.lang.String getNameSpacePrefix()
230   {
231     return _nsPrefix;
232   }
233
234   /**
235    * Method getNameSpaceURI.
236    * 
237    * @return the namespace URI used when marshaling and unmarshaling as XML.
238    */
239   public java.lang.String getNameSpaceURI()
240   {
241     return _nsURI;
242   }
243
244   /**
245    * Method getValidator.
246    * 
247    * @return a specific validator for the class described by this
248    *         ClassDescriptor.
249    */
250   public org.exolab.castor.xml.TypeValidator getValidator()
251   {
252     return this;
253   }
254
255   /**
256    * Method getXMLName.
257    * 
258    * @return the XML Name for the Class being described.
259    */
260   public java.lang.String getXMLName()
261   {
262     return _xmlName;
263   }
264
265   /**
266    * Method isElementDefinition.
267    * 
268    * @return true if XML schema definition of this Class is that of a global
269    *         element or element with anonymous type definition.
270    */
271   public boolean isElementDefinition()
272   {
273     return _elementDefinition;
274   }
275
276 }