2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.MapListType;
28 * Class MapListTypeDescriptor.
30 * @version $Revision$ $Date$
32 public class MapListTypeDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public MapListTypeDescriptor()
67 _nsURI = "www.vamsas.ac.uk/jalview/version2";
68 _xmlName = "mapListType";
69 _elementDefinition = false;
71 // -- set grouping compositor
72 setCompositorAsSequence();
73 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
74 org.exolab.castor.mapping.FieldHandler handler = null;
75 org.exolab.castor.xml.FieldValidator fieldValidator = null;
76 // -- initialize attribute descriptors
79 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
80 java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit",
81 org.exolab.castor.xml.NodeType.Attribute);
82 handler = new org.exolab.castor.xml.XMLFieldHandler()
84 public java.lang.Object getValue(java.lang.Object object)
85 throws IllegalStateException
87 MapListType target = (MapListType) object;
88 if (!target.hasMapFromUnit())
92 return new java.lang.Long(target.getMapFromUnit());
95 public void setValue(java.lang.Object object, java.lang.Object value)
96 throws IllegalStateException, IllegalArgumentException
100 MapListType target = (MapListType) object;
101 // ignore null values for non optional primitives
107 target.setMapFromUnit(((java.lang.Long) value).longValue());
108 } catch (java.lang.Exception ex)
110 throw new IllegalStateException(ex.toString());
114 public java.lang.Object newInstance(java.lang.Object parent)
119 desc.setHandler(handler);
120 desc.setRequired(true);
121 desc.setMultivalued(false);
122 addFieldDescriptor(desc);
124 // -- validation code for: _mapFromUnit
125 fieldValidator = new org.exolab.castor.xml.FieldValidator();
126 fieldValidator.setMinOccurs(1);
128 org.exolab.castor.xml.validators.LongValidator typeValidator;
129 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
130 fieldValidator.setValidator(typeValidator);
131 typeValidator.setMinInclusive(1L);
133 desc.setValidator(fieldValidator);
135 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
136 java.lang.Long.TYPE, "_mapToUnit", "mapToUnit",
137 org.exolab.castor.xml.NodeType.Attribute);
138 handler = new org.exolab.castor.xml.XMLFieldHandler()
140 public java.lang.Object getValue(java.lang.Object object)
141 throws IllegalStateException
143 MapListType target = (MapListType) object;
144 if (!target.hasMapToUnit())
148 return new java.lang.Long(target.getMapToUnit());
151 public void setValue(java.lang.Object object, java.lang.Object value)
152 throws IllegalStateException, IllegalArgumentException
156 MapListType target = (MapListType) object;
157 // ignore null values for non optional primitives
163 target.setMapToUnit(((java.lang.Long) value).longValue());
164 } catch (java.lang.Exception ex)
166 throw new IllegalStateException(ex.toString());
170 public java.lang.Object newInstance(java.lang.Object parent)
175 desc.setHandler(handler);
176 desc.setRequired(true);
177 desc.setMultivalued(false);
178 addFieldDescriptor(desc);
180 // -- validation code for: _mapToUnit
181 fieldValidator = new org.exolab.castor.xml.FieldValidator();
182 fieldValidator.setMinOccurs(1);
184 org.exolab.castor.xml.validators.LongValidator typeValidator;
185 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
186 fieldValidator.setValidator(typeValidator);
187 typeValidator.setMinInclusive(1L);
189 desc.setValidator(fieldValidator);
190 // -- initialize element descriptors
192 // -- _mapListFromList
193 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
194 jalview.schemabinding.version2.MapListFrom.class,
195 "_mapListFromList", "mapListFrom",
196 org.exolab.castor.xml.NodeType.Element);
197 handler = new org.exolab.castor.xml.XMLFieldHandler()
199 public java.lang.Object getValue(java.lang.Object object)
200 throws IllegalStateException
202 MapListType target = (MapListType) object;
203 return target.getMapListFrom();
206 public void setValue(java.lang.Object object, java.lang.Object value)
207 throws IllegalStateException, IllegalArgumentException
211 MapListType target = (MapListType) object;
212 target.addMapListFrom((jalview.schemabinding.version2.MapListFrom) value);
213 } catch (java.lang.Exception ex)
215 throw new IllegalStateException(ex.toString());
219 public void resetValue(Object object) throws IllegalStateException,
220 IllegalArgumentException
224 MapListType target = (MapListType) object;
225 target.removeAllMapListFrom();
226 } catch (java.lang.Exception ex)
228 throw new IllegalStateException(ex.toString());
232 public java.lang.Object newInstance(java.lang.Object parent)
234 return new jalview.schemabinding.version2.MapListFrom();
237 desc.setHandler(handler);
238 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
239 desc.setMultivalued(true);
240 addFieldDescriptor(desc);
242 // -- validation code for: _mapListFromList
243 fieldValidator = new org.exolab.castor.xml.FieldValidator();
244 fieldValidator.setMinOccurs(0);
247 desc.setValidator(fieldValidator);
249 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
250 jalview.schemabinding.version2.MapListTo.class,
251 "_mapListToList", "mapListTo",
252 org.exolab.castor.xml.NodeType.Element);
253 handler = new org.exolab.castor.xml.XMLFieldHandler()
255 public java.lang.Object getValue(java.lang.Object object)
256 throws IllegalStateException
258 MapListType target = (MapListType) object;
259 return target.getMapListTo();
262 public void setValue(java.lang.Object object, java.lang.Object value)
263 throws IllegalStateException, IllegalArgumentException
267 MapListType target = (MapListType) object;
268 target.addMapListTo((jalview.schemabinding.version2.MapListTo) value);
269 } catch (java.lang.Exception ex)
271 throw new IllegalStateException(ex.toString());
275 public void resetValue(Object object) throws IllegalStateException,
276 IllegalArgumentException
280 MapListType target = (MapListType) object;
281 target.removeAllMapListTo();
282 } catch (java.lang.Exception ex)
284 throw new IllegalStateException(ex.toString());
288 public java.lang.Object newInstance(java.lang.Object parent)
290 return new jalview.schemabinding.version2.MapListTo();
293 desc.setHandler(handler);
294 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
295 desc.setMultivalued(true);
296 addFieldDescriptor(desc);
298 // -- validation code for: _mapListToList
299 fieldValidator = new org.exolab.castor.xml.FieldValidator();
300 fieldValidator.setMinOccurs(0);
303 desc.setValidator(fieldValidator);
311 * Method getAccessMode.
313 * @return the access mode specified for this class.
315 public org.exolab.castor.mapping.AccessMode getAccessMode()
321 * Method getIdentity.
323 * @return the identity field, null if this class has no identity.
325 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
327 return super.getIdentity();
331 * Method getJavaClass.
333 * @return the Java class represented by this descriptor.
335 public java.lang.Class getJavaClass()
337 return jalview.schemabinding.version2.MapListType.class;
341 * Method getNameSpacePrefix.
343 * @return the namespace prefix to use when marshaling as XML.
345 public java.lang.String getNameSpacePrefix()
351 * Method getNameSpaceURI.
353 * @return the namespace URI used when marshaling and unmarshaling as XML.
355 public java.lang.String getNameSpaceURI()
361 * Method getValidator.
363 * @return a specific validator for the class described by this
366 public org.exolab.castor.xml.TypeValidator getValidator()
374 * @return the XML Name for the Class being described.
376 public java.lang.String getXMLName()
382 * Method isElementDefinition.
384 * @return true if XML schema definition of this Class is that of a global
385 * element or element with anonymous type definition.
387 public boolean isElementDefinition()
389 return _elementDefinition;