8df53affbbca44981df9d572e8b6f76a640ebad5
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / HiddenColumnsDescriptor.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.HiddenColumns;
25
26 /**
27  * Class HiddenColumnsDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class HiddenColumnsDescriptor 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 HiddenColumnsDescriptor()
64   {
65     super();
66     _nsURI = "www.jalview.org";
67     _xmlName = "hiddenColumns";
68     _elementDefinition = true;
69     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
70     org.exolab.castor.mapping.FieldHandler handler = null;
71     org.exolab.castor.xml.FieldValidator fieldValidator = null;
72     // -- initialize attribute descriptors
73
74     // -- _start
75     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
76             java.lang.Integer.TYPE, "_start", "start",
77             org.exolab.castor.xml.NodeType.Attribute);
78     handler = new org.exolab.castor.xml.XMLFieldHandler()
79     {
80       public java.lang.Object getValue(java.lang.Object object)
81               throws IllegalStateException
82       {
83         HiddenColumns target = (HiddenColumns) object;
84         if (!target.hasStart())
85         {
86           return null;
87         }
88         return new java.lang.Integer(target.getStart());
89       }
90
91       public void setValue(java.lang.Object object, java.lang.Object value)
92               throws IllegalStateException, IllegalArgumentException
93       {
94         try
95         {
96           HiddenColumns target = (HiddenColumns) object;
97           // if null, use delete method for optional primitives
98           if (value == null)
99           {
100             target.deleteStart();
101             return;
102           }
103           target.setStart(((java.lang.Integer) value).intValue());
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.setMultivalued(false);
117     addFieldDescriptor(desc);
118
119     // -- validation code for: _start
120     fieldValidator = new org.exolab.castor.xml.FieldValidator();
121     { // -- local scope
122       org.exolab.castor.xml.validators.IntValidator typeValidator;
123       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
124       fieldValidator.setValidator(typeValidator);
125       typeValidator.setMinInclusive(-2147483648);
126       typeValidator.setMaxInclusive(2147483647);
127     }
128     desc.setValidator(fieldValidator);
129     // -- _end
130     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
131             java.lang.Integer.TYPE, "_end", "end",
132             org.exolab.castor.xml.NodeType.Attribute);
133     handler = new org.exolab.castor.xml.XMLFieldHandler()
134     {
135       public java.lang.Object getValue(java.lang.Object object)
136               throws IllegalStateException
137       {
138         HiddenColumns target = (HiddenColumns) object;
139         if (!target.hasEnd())
140         {
141           return null;
142         }
143         return new java.lang.Integer(target.getEnd());
144       }
145
146       public void setValue(java.lang.Object object, java.lang.Object value)
147               throws IllegalStateException, IllegalArgumentException
148       {
149         try
150         {
151           HiddenColumns target = (HiddenColumns) object;
152           // if null, use delete method for optional primitives
153           if (value == null)
154           {
155             target.deleteEnd();
156             return;
157           }
158           target.setEnd(((java.lang.Integer) value).intValue());
159         } catch (java.lang.Exception ex)
160         {
161           throw new IllegalStateException(ex.toString());
162         }
163       }
164
165       public java.lang.Object newInstance(java.lang.Object parent)
166       {
167         return null;
168       }
169     };
170     desc.setHandler(handler);
171     desc.setMultivalued(false);
172     addFieldDescriptor(desc);
173
174     // -- validation code for: _end
175     fieldValidator = new org.exolab.castor.xml.FieldValidator();
176     { // -- local scope
177       org.exolab.castor.xml.validators.IntValidator typeValidator;
178       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
179       fieldValidator.setValidator(typeValidator);
180       typeValidator.setMinInclusive(-2147483648);
181       typeValidator.setMaxInclusive(2147483647);
182     }
183     desc.setValidator(fieldValidator);
184     // -- initialize element descriptors
185
186   }
187
188   // -----------/
189   // - Methods -/
190   // -----------/
191
192   /**
193    * Method getAccessMode.
194    * 
195    * @return the access mode specified for this class.
196    */
197   public org.exolab.castor.mapping.AccessMode getAccessMode()
198   {
199     return null;
200   }
201
202   /**
203    * Method getIdentity.
204    * 
205    * @return the identity field, null if this class has no identity.
206    */
207   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
208   {
209     return super.getIdentity();
210   }
211
212   /**
213    * Method getJavaClass.
214    * 
215    * @return the Java class represented by this descriptor.
216    */
217   public java.lang.Class getJavaClass()
218   {
219     return jalview.schemabinding.version2.HiddenColumns.class;
220   }
221
222   /**
223    * Method getNameSpacePrefix.
224    * 
225    * @return the namespace prefix to use when marshaling as XML.
226    */
227   public java.lang.String getNameSpacePrefix()
228   {
229     return _nsPrefix;
230   }
231
232   /**
233    * Method getNameSpaceURI.
234    * 
235    * @return the namespace URI used when marshaling and unmarshaling as XML.
236    */
237   public java.lang.String getNameSpaceURI()
238   {
239     return _nsURI;
240   }
241
242   /**
243    * Method getValidator.
244    * 
245    * @return a specific validator for the class described by this
246    *         ClassDescriptor.
247    */
248   public org.exolab.castor.xml.TypeValidator getValidator()
249   {
250     return this;
251   }
252
253   /**
254    * Method getXMLName.
255    * 
256    * @return the XML Name for the Class being described.
257    */
258   public java.lang.String getXMLName()
259   {
260     return _xmlName;
261   }
262
263   /**
264    * Method isElementDefinition.
265    * 
266    * @return true if XML schema definition of this Class is that of a global
267    *         element or element with anonymous type definition.
268    */
269   public boolean isElementDefinition()
270   {
271     return _elementDefinition;
272   }
273
274 }