2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2.descriptors;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.schemabinding.version2.MapListType;
30 * Class MapListTypeDescriptor.
32 * @version $Revision$ $Date$
34 public class MapListTypeDescriptor extends
35 org.exolab.castor.xml.util.XMLClassDescriptorImpl
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * Field _elementDefinition.
45 private boolean _elementDefinition;
50 private java.lang.String _nsPrefix;
55 private java.lang.String _nsURI;
60 private java.lang.String _xmlName;
66 public MapListTypeDescriptor()
69 _nsURI = "www.vamsas.ac.uk/jalview/version2";
70 _xmlName = "mapListType";
71 _elementDefinition = false;
73 // -- set grouping compositor
74 setCompositorAsSequence();
75 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
76 org.exolab.castor.mapping.FieldHandler handler = null;
77 org.exolab.castor.xml.FieldValidator fieldValidator = null;
78 // -- initialize attribute descriptors
81 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
82 java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit",
83 org.exolab.castor.xml.NodeType.Attribute);
84 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())
94 return new java.lang.Long(target.getMapFromUnit());
97 public void setValue(java.lang.Object object, java.lang.Object value)
98 throws IllegalStateException, IllegalArgumentException
102 MapListType target = (MapListType) object;
103 // ignore null values for non optional primitives
109 target.setMapFromUnit(((java.lang.Long) value).longValue());
110 } catch (java.lang.Exception ex)
112 throw new IllegalStateException(ex.toString());
116 public java.lang.Object newInstance(java.lang.Object parent)
121 desc.setHandler(handler);
122 desc.setRequired(true);
123 desc.setMultivalued(false);
124 addFieldDescriptor(desc);
126 // -- validation code for: _mapFromUnit
127 fieldValidator = new org.exolab.castor.xml.FieldValidator();
128 fieldValidator.setMinOccurs(1);
130 org.exolab.castor.xml.validators.LongValidator typeValidator;
131 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
132 fieldValidator.setValidator(typeValidator);
133 typeValidator.setMinInclusive(1L);
135 desc.setValidator(fieldValidator);
137 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
138 java.lang.Long.TYPE, "_mapToUnit", "mapToUnit",
139 org.exolab.castor.xml.NodeType.Attribute);
140 handler = new org.exolab.castor.xml.XMLFieldHandler()
142 public java.lang.Object getValue(java.lang.Object object)
143 throws IllegalStateException
145 MapListType target = (MapListType) object;
146 if (!target.hasMapToUnit())
150 return new java.lang.Long(target.getMapToUnit());
153 public void setValue(java.lang.Object object, java.lang.Object value)
154 throws IllegalStateException, IllegalArgumentException
158 MapListType target = (MapListType) object;
159 // ignore null values for non optional primitives
165 target.setMapToUnit(((java.lang.Long) value).longValue());
166 } catch (java.lang.Exception ex)
168 throw new IllegalStateException(ex.toString());
172 public java.lang.Object newInstance(java.lang.Object parent)
177 desc.setHandler(handler);
178 desc.setRequired(true);
179 desc.setMultivalued(false);
180 addFieldDescriptor(desc);
182 // -- validation code for: _mapToUnit
183 fieldValidator = new org.exolab.castor.xml.FieldValidator();
184 fieldValidator.setMinOccurs(1);
186 org.exolab.castor.xml.validators.LongValidator typeValidator;
187 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
188 fieldValidator.setValidator(typeValidator);
189 typeValidator.setMinInclusive(1L);
191 desc.setValidator(fieldValidator);
192 // -- initialize element descriptors
194 // -- _mapListFromList
195 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
196 jalview.schemabinding.version2.MapListFrom.class,
197 "_mapListFromList", "mapListFrom",
198 org.exolab.castor.xml.NodeType.Element);
199 handler = new org.exolab.castor.xml.XMLFieldHandler()
201 public java.lang.Object getValue(java.lang.Object object)
202 throws IllegalStateException
204 MapListType target = (MapListType) object;
205 return target.getMapListFrom();
208 public void setValue(java.lang.Object object, java.lang.Object value)
209 throws IllegalStateException, IllegalArgumentException
213 MapListType target = (MapListType) object;
214 target.addMapListFrom((jalview.schemabinding.version2.MapListFrom) value);
215 } catch (java.lang.Exception ex)
217 throw new IllegalStateException(ex.toString());
221 public void resetValue(Object object) throws IllegalStateException,
222 IllegalArgumentException
226 MapListType target = (MapListType) object;
227 target.removeAllMapListFrom();
228 } catch (java.lang.Exception ex)
230 throw new IllegalStateException(ex.toString());
234 public java.lang.Object newInstance(java.lang.Object parent)
236 return new jalview.schemabinding.version2.MapListFrom();
239 desc.setHandler(handler);
240 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
241 desc.setMultivalued(true);
242 addFieldDescriptor(desc);
244 // -- validation code for: _mapListFromList
245 fieldValidator = new org.exolab.castor.xml.FieldValidator();
246 fieldValidator.setMinOccurs(0);
249 desc.setValidator(fieldValidator);
251 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
252 jalview.schemabinding.version2.MapListTo.class,
253 "_mapListToList", "mapListTo",
254 org.exolab.castor.xml.NodeType.Element);
255 handler = new org.exolab.castor.xml.XMLFieldHandler()
257 public java.lang.Object getValue(java.lang.Object object)
258 throws IllegalStateException
260 MapListType target = (MapListType) object;
261 return target.getMapListTo();
264 public void setValue(java.lang.Object object, java.lang.Object value)
265 throws IllegalStateException, IllegalArgumentException
269 MapListType target = (MapListType) object;
270 target.addMapListTo((jalview.schemabinding.version2.MapListTo) value);
271 } catch (java.lang.Exception ex)
273 throw new IllegalStateException(ex.toString());
277 public void resetValue(Object object) throws IllegalStateException,
278 IllegalArgumentException
282 MapListType target = (MapListType) object;
283 target.removeAllMapListTo();
284 } catch (java.lang.Exception ex)
286 throw new IllegalStateException(ex.toString());
290 public java.lang.Object newInstance(java.lang.Object parent)
292 return new jalview.schemabinding.version2.MapListTo();
295 desc.setHandler(handler);
296 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
297 desc.setMultivalued(true);
298 addFieldDescriptor(desc);
300 // -- validation code for: _mapListToList
301 fieldValidator = new org.exolab.castor.xml.FieldValidator();
302 fieldValidator.setMinOccurs(0);
305 desc.setValidator(fieldValidator);
313 * Method getAccessMode.
315 * @return the access mode specified for this class.
317 public org.exolab.castor.mapping.AccessMode getAccessMode()
323 * Method getIdentity.
325 * @return the identity field, null if this class has no identity.
327 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
329 return super.getIdentity();
333 * Method getJavaClass.
335 * @return the Java class represented by this descriptor.
337 public java.lang.Class getJavaClass()
339 return jalview.schemabinding.version2.MapListType.class;
343 * Method getNameSpacePrefix.
345 * @return the namespace prefix to use when marshaling as XML.
347 public java.lang.String getNameSpacePrefix()
353 * Method getNameSpaceURI.
355 * @return the namespace URI used when marshaling and unmarshaling as XML.
357 public java.lang.String getNameSpaceURI()
363 * Method getValidator.
365 * @return a specific validator for the class described by this
368 public org.exolab.castor.xml.TypeValidator getValidator()
376 * @return the XML Name for the Class being described.
378 public java.lang.String getXMLName()
384 * Method isElementDefinition.
386 * @return true if XML schema definition of this Class is that of a global
387 * element or element with anonymous type definition.
389 public boolean isElementDefinition()
391 return _elementDefinition;