1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.MapListType;
34 * Class MapListTypeDescriptor.
36 * @version $Revision$ $Date$
38 public class MapListTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41 //--------------------------/
42 //- Class/Member Variables -/
43 //--------------------------/
46 * Field _elementDefinition.
48 private boolean _elementDefinition;
53 private java.lang.String _nsPrefix;
58 private java.lang.String _nsURI;
63 private java.lang.String _xmlName;
70 public MapListTypeDescriptor() {
72 _nsURI = "www.vamsas.ac.uk/jalview/version2";
73 _xmlName = "mapListType";
74 _elementDefinition = false;
76 //-- set grouping compositor
77 setCompositorAsSequence();
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
84 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit", org.exolab.castor.xml.NodeType.Attribute);
85 handler = new org.exolab.castor.xml.XMLFieldHandler() {
86 public java.lang.Object getValue( java.lang.Object object )
87 throws IllegalStateException
89 MapListType target = (MapListType) object;
90 if (!target.hasMapFromUnit()) { return null; }
91 return new java.lang.Long(target.getMapFromUnit());
93 public void setValue( java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
97 MapListType target = (MapListType) object;
98 // ignore null values for non optional primitives
99 if (value == null) { return; }
101 target.setMapFromUnit( ((java.lang.Long) value).longValue());
102 } catch (java.lang.Exception ex) {
103 throw new IllegalStateException(ex.toString());
106 public java.lang.Object newInstance(java.lang.Object parent) {
110 desc.setHandler(handler);
111 desc.setRequired(true);
112 desc.setMultivalued(false);
113 addFieldDescriptor(desc);
115 //-- validation code for: _mapFromUnit
116 fieldValidator = new org.exolab.castor.xml.FieldValidator();
117 fieldValidator.setMinOccurs(1);
119 org.exolab.castor.xml.validators.LongValidator typeValidator;
120 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
121 fieldValidator.setValidator(typeValidator);
122 typeValidator.setMinInclusive(1L);
124 desc.setValidator(fieldValidator);
126 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_mapToUnit", "mapToUnit", org.exolab.castor.xml.NodeType.Attribute);
127 handler = new org.exolab.castor.xml.XMLFieldHandler() {
128 public java.lang.Object getValue( java.lang.Object object )
129 throws IllegalStateException
131 MapListType target = (MapListType) object;
132 if (!target.hasMapToUnit()) { return null; }
133 return new java.lang.Long(target.getMapToUnit());
135 public void setValue( java.lang.Object object, java.lang.Object value)
136 throws IllegalStateException, IllegalArgumentException
139 MapListType target = (MapListType) object;
140 // ignore null values for non optional primitives
141 if (value == null) { return; }
143 target.setMapToUnit( ((java.lang.Long) value).longValue());
144 } catch (java.lang.Exception ex) {
145 throw new IllegalStateException(ex.toString());
148 public java.lang.Object newInstance(java.lang.Object parent) {
152 desc.setHandler(handler);
153 desc.setRequired(true);
154 desc.setMultivalued(false);
155 addFieldDescriptor(desc);
157 //-- validation code for: _mapToUnit
158 fieldValidator = new org.exolab.castor.xml.FieldValidator();
159 fieldValidator.setMinOccurs(1);
161 org.exolab.castor.xml.validators.LongValidator typeValidator;
162 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
163 fieldValidator.setValidator(typeValidator);
164 typeValidator.setMinInclusive(1L);
166 desc.setValidator(fieldValidator);
167 //-- initialize element descriptors
169 //-- _mapListFromList
170 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.MapListFrom.class, "_mapListFromList", "mapListFrom", org.exolab.castor.xml.NodeType.Element);
171 handler = new org.exolab.castor.xml.XMLFieldHandler() {
172 public java.lang.Object getValue( java.lang.Object object )
173 throws IllegalStateException
175 MapListType target = (MapListType) object;
176 return target.getMapListFrom();
178 public void setValue( java.lang.Object object, java.lang.Object value)
179 throws IllegalStateException, IllegalArgumentException
182 MapListType target = (MapListType) object;
183 target.addMapListFrom( (jalview.schemabinding.version2.MapListFrom) value);
184 } catch (java.lang.Exception ex) {
185 throw new IllegalStateException(ex.toString());
188 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
190 MapListType target = (MapListType) object;
191 target.removeAllMapListFrom();
192 } catch (java.lang.Exception ex) {
193 throw new IllegalStateException(ex.toString());
196 public java.lang.Object newInstance(java.lang.Object parent) {
197 return new jalview.schemabinding.version2.MapListFrom();
200 desc.setHandler(handler);
201 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
202 desc.setMultivalued(true);
203 addFieldDescriptor(desc);
205 //-- validation code for: _mapListFromList
206 fieldValidator = new org.exolab.castor.xml.FieldValidator();
207 fieldValidator.setMinOccurs(0);
210 desc.setValidator(fieldValidator);
212 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.MapListTo.class, "_mapListToList", "mapListTo", org.exolab.castor.xml.NodeType.Element);
213 handler = new org.exolab.castor.xml.XMLFieldHandler() {
214 public java.lang.Object getValue( java.lang.Object object )
215 throws IllegalStateException
217 MapListType target = (MapListType) object;
218 return target.getMapListTo();
220 public void setValue( java.lang.Object object, java.lang.Object value)
221 throws IllegalStateException, IllegalArgumentException
224 MapListType target = (MapListType) object;
225 target.addMapListTo( (jalview.schemabinding.version2.MapListTo) value);
226 } catch (java.lang.Exception ex) {
227 throw new IllegalStateException(ex.toString());
230 public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
232 MapListType target = (MapListType) object;
233 target.removeAllMapListTo();
234 } catch (java.lang.Exception ex) {
235 throw new IllegalStateException(ex.toString());
238 public java.lang.Object newInstance(java.lang.Object parent) {
239 return new jalview.schemabinding.version2.MapListTo();
242 desc.setHandler(handler);
243 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
244 desc.setMultivalued(true);
245 addFieldDescriptor(desc);
247 //-- validation code for: _mapListToList
248 fieldValidator = new org.exolab.castor.xml.FieldValidator();
249 fieldValidator.setMinOccurs(0);
252 desc.setValidator(fieldValidator);
261 * Method getAccessMode.
263 * @return the access mode specified for this class.
265 public org.exolab.castor.mapping.AccessMode getAccessMode(
271 * Method getIdentity.
273 * @return the identity field, null if this class has no
276 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
278 return super.getIdentity();
282 * Method getJavaClass.
284 * @return the Java class represented by this descriptor.
286 public java.lang.Class getJavaClass(
288 return jalview.schemabinding.version2.MapListType.class;
292 * Method getNameSpacePrefix.
294 * @return the namespace prefix to use when marshaling as XML.
296 public java.lang.String getNameSpacePrefix(
302 * Method getNameSpaceURI.
304 * @return the namespace URI used when marshaling and
305 * unmarshaling as XML.
307 public java.lang.String getNameSpaceURI(
313 * Method getValidator.
315 * @return a specific validator for the class described by this
318 public org.exolab.castor.xml.TypeValidator getValidator(
326 * @return the XML Name for the Class being described.
328 public java.lang.String getXMLName(
334 * Method isElementDefinition.
336 * @return true if XML schema definition of this Class is that
338 * element or element with anonymous type definition.
340 public boolean isElementDefinition(
342 return _elementDefinition;