2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
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.MapListTo;
30 * Class MapListToDescriptor.
32 * @version $Revision$ $Date$
34 public class MapListToDescriptor 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 MapListToDescriptor()
69 _nsURI = "www.vamsas.ac.uk/jalview/version2";
70 _xmlName = "mapListTo";
71 _elementDefinition = true;
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.Integer.TYPE, "_start", "start",
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 MapListTo target = (MapListTo) object;
87 if (!target.hasStart())
91 return new java.lang.Integer(target.getStart());
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 MapListTo target = (MapListTo) object;
100 // ignore null values for non optional primitives
106 target.setStart(((java.lang.Integer) value).intValue());
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: _start
124 fieldValidator = new org.exolab.castor.xml.FieldValidator();
125 fieldValidator.setMinOccurs(1);
127 org.exolab.castor.xml.validators.IntValidator typeValidator;
128 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
129 fieldValidator.setValidator(typeValidator);
130 typeValidator.setMinInclusive(-2147483648);
131 typeValidator.setMaxInclusive(2147483647);
133 desc.setValidator(fieldValidator);
135 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
136 java.lang.Integer.TYPE, "_end", "end",
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 MapListTo target = (MapListTo) object;
144 if (!target.hasEnd())
148 return new java.lang.Integer(target.getEnd());
151 public void setValue(java.lang.Object object, java.lang.Object value)
152 throws IllegalStateException, IllegalArgumentException
156 MapListTo target = (MapListTo) object;
157 // ignore null values for non optional primitives
163 target.setEnd(((java.lang.Integer) value).intValue());
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: _end
181 fieldValidator = new org.exolab.castor.xml.FieldValidator();
182 fieldValidator.setMinOccurs(1);
184 org.exolab.castor.xml.validators.IntValidator typeValidator;
185 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
186 fieldValidator.setValidator(typeValidator);
187 typeValidator.setMinInclusive(-2147483648);
188 typeValidator.setMaxInclusive(2147483647);
190 desc.setValidator(fieldValidator);
191 // -- initialize element descriptors
200 * Method getAccessMode.
202 * @return the access mode specified for this class.
204 public org.exolab.castor.mapping.AccessMode getAccessMode()
210 * Method getIdentity.
212 * @return the identity field, null if this class has no identity.
214 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
216 return super.getIdentity();
220 * Method getJavaClass.
222 * @return the Java class represented by this descriptor.
224 public java.lang.Class getJavaClass()
226 return jalview.schemabinding.version2.MapListTo.class;
230 * Method getNameSpacePrefix.
232 * @return the namespace prefix to use when marshaling as XML.
234 public java.lang.String getNameSpacePrefix()
240 * Method getNameSpaceURI.
242 * @return the namespace URI used when marshaling and unmarshaling as XML.
244 public java.lang.String getNameSpaceURI()
250 * Method getValidator.
252 * @return a specific validator for the class described by this
255 public org.exolab.castor.xml.TypeValidator getValidator()
263 * @return the XML Name for the Class being described.
265 public java.lang.String getXMLName()
271 * Method isElementDefinition.
273 * @return true if XML schema definition of this Class is that of a global
274 * element or element with anonymous type definition.
276 public boolean isElementDefinition()
278 return _elementDefinition;