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
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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.MapListType;
27 * Class MapListTypeDescriptor.
29 * @version $Revision$ $Date$
31 public class MapListTypeDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public MapListTypeDescriptor()
66 _nsURI = "www.vamsas.ac.uk/jalview/version2";
67 _xmlName = "mapListType";
68 _elementDefinition = false;
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
78 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
79 java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit",
80 org.exolab.castor.xml.NodeType.Attribute);
81 handler = new org.exolab.castor.xml.XMLFieldHandler()
83 public java.lang.Object getValue(java.lang.Object object)
84 throws IllegalStateException
86 MapListType target = (MapListType) object;
87 if (!target.hasMapFromUnit())
91 return new java.lang.Long(target.getMapFromUnit());
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 MapListType target = (MapListType) object;
100 // ignore null values for non optional primitives
106 target.setMapFromUnit(((java.lang.Long) value).longValue());
107 } catch (java.lang.Exception ex)
109 throw new IllegalStateException(ex.toString());
113 public java.lang.Object newInstance(java.lang.Object parent)
118 desc.setHandler(handler);
119 desc.setRequired(true);
120 desc.setMultivalued(false);
121 addFieldDescriptor(desc);
123 // -- validation code for: _mapFromUnit
124 fieldValidator = new org.exolab.castor.xml.FieldValidator();
125 fieldValidator.setMinOccurs(1);
127 org.exolab.castor.xml.validators.LongValidator typeValidator;
128 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
129 fieldValidator.setValidator(typeValidator);
130 typeValidator.setMinInclusive(1L);
132 desc.setValidator(fieldValidator);
134 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
135 java.lang.Long.TYPE, "_mapToUnit", "mapToUnit",
136 org.exolab.castor.xml.NodeType.Attribute);
137 handler = new org.exolab.castor.xml.XMLFieldHandler()
139 public java.lang.Object getValue(java.lang.Object object)
140 throws IllegalStateException
142 MapListType target = (MapListType) object;
143 if (!target.hasMapToUnit())
147 return new java.lang.Long(target.getMapToUnit());
150 public void setValue(java.lang.Object object, java.lang.Object value)
151 throws IllegalStateException, IllegalArgumentException
155 MapListType target = (MapListType) object;
156 // ignore null values for non optional primitives
162 target.setMapToUnit(((java.lang.Long) value).longValue());
163 } catch (java.lang.Exception ex)
165 throw new IllegalStateException(ex.toString());
169 public java.lang.Object newInstance(java.lang.Object parent)
174 desc.setHandler(handler);
175 desc.setRequired(true);
176 desc.setMultivalued(false);
177 addFieldDescriptor(desc);
179 // -- validation code for: _mapToUnit
180 fieldValidator = new org.exolab.castor.xml.FieldValidator();
181 fieldValidator.setMinOccurs(1);
183 org.exolab.castor.xml.validators.LongValidator typeValidator;
184 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
185 fieldValidator.setValidator(typeValidator);
186 typeValidator.setMinInclusive(1L);
188 desc.setValidator(fieldValidator);
189 // -- initialize element descriptors
191 // -- _mapListFromList
192 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
193 jalview.schemabinding.version2.MapListFrom.class,
194 "_mapListFromList", "mapListFrom",
195 org.exolab.castor.xml.NodeType.Element);
196 handler = new org.exolab.castor.xml.XMLFieldHandler()
198 public java.lang.Object getValue(java.lang.Object object)
199 throws IllegalStateException
201 MapListType target = (MapListType) object;
202 return target.getMapListFrom();
205 public void setValue(java.lang.Object object, java.lang.Object value)
206 throws IllegalStateException, IllegalArgumentException
210 MapListType target = (MapListType) object;
211 target.addMapListFrom((jalview.schemabinding.version2.MapListFrom) value);
212 } catch (java.lang.Exception ex)
214 throw new IllegalStateException(ex.toString());
218 public void resetValue(Object object) throws IllegalStateException,
219 IllegalArgumentException
223 MapListType target = (MapListType) object;
224 target.removeAllMapListFrom();
225 } catch (java.lang.Exception ex)
227 throw new IllegalStateException(ex.toString());
231 public java.lang.Object newInstance(java.lang.Object parent)
233 return new jalview.schemabinding.version2.MapListFrom();
236 desc.setHandler(handler);
237 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
238 desc.setMultivalued(true);
239 addFieldDescriptor(desc);
241 // -- validation code for: _mapListFromList
242 fieldValidator = new org.exolab.castor.xml.FieldValidator();
243 fieldValidator.setMinOccurs(0);
246 desc.setValidator(fieldValidator);
248 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
249 jalview.schemabinding.version2.MapListTo.class,
250 "_mapListToList", "mapListTo",
251 org.exolab.castor.xml.NodeType.Element);
252 handler = new org.exolab.castor.xml.XMLFieldHandler()
254 public java.lang.Object getValue(java.lang.Object object)
255 throws IllegalStateException
257 MapListType target = (MapListType) object;
258 return target.getMapListTo();
261 public void setValue(java.lang.Object object, java.lang.Object value)
262 throws IllegalStateException, IllegalArgumentException
266 MapListType target = (MapListType) object;
267 target.addMapListTo((jalview.schemabinding.version2.MapListTo) value);
268 } catch (java.lang.Exception ex)
270 throw new IllegalStateException(ex.toString());
274 public void resetValue(Object object) throws IllegalStateException,
275 IllegalArgumentException
279 MapListType target = (MapListType) object;
280 target.removeAllMapListTo();
281 } catch (java.lang.Exception ex)
283 throw new IllegalStateException(ex.toString());
287 public java.lang.Object newInstance(java.lang.Object parent)
289 return new jalview.schemabinding.version2.MapListTo();
292 desc.setHandler(handler);
293 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
294 desc.setMultivalued(true);
295 addFieldDescriptor(desc);
297 // -- validation code for: _mapListToList
298 fieldValidator = new org.exolab.castor.xml.FieldValidator();
299 fieldValidator.setMinOccurs(0);
302 desc.setValidator(fieldValidator);
310 * Method getAccessMode.
312 * @return the access mode specified for this class.
314 public org.exolab.castor.mapping.AccessMode getAccessMode()
320 * Method getIdentity.
322 * @return the identity field, null if this class has no identity.
324 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
326 return super.getIdentity();
330 * Method getJavaClass.
332 * @return the Java class represented by this descriptor.
334 public java.lang.Class getJavaClass()
336 return jalview.schemabinding.version2.MapListType.class;
340 * Method getNameSpacePrefix.
342 * @return the namespace prefix to use when marshaling as XML.
344 public java.lang.String getNameSpacePrefix()
350 * Method getNameSpaceURI.
352 * @return the namespace URI used when marshaling and unmarshaling as XML.
354 public java.lang.String getNameSpaceURI()
360 * Method getValidator.
362 * @return a specific validator for the class described by this
365 public org.exolab.castor.xml.TypeValidator getValidator()
373 * @return the XML Name for the Class being described.
375 public java.lang.String getXMLName()
381 * Method isElementDefinition.
383 * @return true if XML schema definition of this Class is that of a global
384 * element or element with anonymous type definition.
386 public boolean isElementDefinition()
388 return _elementDefinition;