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.CalcIdParam;
28 * Class CalcIdParamDescriptor.
30 * @version $Revision$ $Date$
32 public class CalcIdParamDescriptor
34 jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
37 // --------------------------/
38 // - Class/Member Variables -/
39 // --------------------------/
42 * Field _elementDefinition.
44 private boolean _elementDefinition;
49 private java.lang.String _nsPrefix;
54 private java.lang.String _nsURI;
59 private java.lang.String _xmlName;
65 public CalcIdParamDescriptor()
68 setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
69 _nsURI = "www.jalview.org";
70 _xmlName = "calcIdParam";
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.String.class, "_calcId", "calcId",
80 org.exolab.castor.xml.NodeType.Attribute);
81 desc.setImmutable(true);
82 handler = new org.exolab.castor.xml.XMLFieldHandler()
84 public java.lang.Object getValue(java.lang.Object object)
85 throws IllegalStateException
87 CalcIdParam target = (CalcIdParam) object;
88 return target.getCalcId();
91 public void setValue(java.lang.Object object, java.lang.Object value)
92 throws IllegalStateException, IllegalArgumentException
96 CalcIdParam target = (CalcIdParam) object;
97 target.setCalcId((java.lang.String) value);
98 } catch (java.lang.Exception ex)
100 throw new IllegalStateException(ex.toString());
104 public java.lang.Object newInstance(java.lang.Object parent)
109 desc.setHandler(handler);
110 desc.setRequired(true);
111 desc.setMultivalued(false);
112 addFieldDescriptor(desc);
114 // -- validation code for: _calcId
115 fieldValidator = new org.exolab.castor.xml.FieldValidator();
116 fieldValidator.setMinOccurs(1);
118 org.exolab.castor.xml.validators.StringValidator typeValidator;
119 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
120 fieldValidator.setValidator(typeValidator);
121 typeValidator.setWhiteSpace("preserve");
123 desc.setValidator(fieldValidator);
125 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
126 java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate",
127 org.exolab.castor.xml.NodeType.Attribute);
128 handler = new org.exolab.castor.xml.XMLFieldHandler()
130 public java.lang.Object getValue(java.lang.Object object)
131 throws IllegalStateException
133 CalcIdParam target = (CalcIdParam) object;
134 if (!target.hasNeedsUpdate())
138 return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE
139 : java.lang.Boolean.FALSE);
142 public void setValue(java.lang.Object object, java.lang.Object value)
143 throws IllegalStateException, IllegalArgumentException
147 CalcIdParam target = (CalcIdParam) object;
148 // if null, use delete method for optional primitives
151 target.deleteNeedsUpdate();
154 target.setNeedsUpdate(((java.lang.Boolean) value).booleanValue());
155 } catch (java.lang.Exception ex)
157 throw new IllegalStateException(ex.toString());
161 public java.lang.Object newInstance(java.lang.Object parent)
166 desc.setHandler(handler);
167 desc.setMultivalued(false);
168 addFieldDescriptor(desc);
170 // -- validation code for: _needsUpdate
171 fieldValidator = new org.exolab.castor.xml.FieldValidator();
173 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
174 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
175 fieldValidator.setValidator(typeValidator);
177 desc.setValidator(fieldValidator);
179 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
180 java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate",
181 org.exolab.castor.xml.NodeType.Attribute);
182 handler = new org.exolab.castor.xml.XMLFieldHandler()
184 public java.lang.Object getValue(java.lang.Object object)
185 throws IllegalStateException
187 CalcIdParam target = (CalcIdParam) object;
188 if (!target.hasAutoUpdate())
192 return (target.getAutoUpdate() ? java.lang.Boolean.TRUE
193 : java.lang.Boolean.FALSE);
196 public void setValue(java.lang.Object object, java.lang.Object value)
197 throws IllegalStateException, IllegalArgumentException
201 CalcIdParam target = (CalcIdParam) object;
202 // ignore null values for non optional primitives
208 target.setAutoUpdate(((java.lang.Boolean) value).booleanValue());
209 } catch (java.lang.Exception ex)
211 throw new IllegalStateException(ex.toString());
215 public java.lang.Object newInstance(java.lang.Object parent)
220 desc.setHandler(handler);
221 desc.setRequired(true);
222 desc.setMultivalued(false);
223 addFieldDescriptor(desc);
225 // -- validation code for: _autoUpdate
226 fieldValidator = new org.exolab.castor.xml.FieldValidator();
227 fieldValidator.setMinOccurs(1);
229 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
230 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
231 fieldValidator.setValidator(typeValidator);
233 desc.setValidator(fieldValidator);
234 // -- initialize element descriptors
243 * Method getAccessMode.
245 * @return the access mode specified for this class.
247 public org.exolab.castor.mapping.AccessMode getAccessMode()
253 * Method getIdentity.
255 * @return the identity field, null if this class has no identity.
257 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
259 return super.getIdentity();
263 * Method getJavaClass.
265 * @return the Java class represented by this descriptor.
267 public java.lang.Class getJavaClass()
269 return jalview.schemabinding.version2.CalcIdParam.class;
273 * Method getNameSpacePrefix.
275 * @return the namespace prefix to use when marshaling as XML.
277 public java.lang.String getNameSpacePrefix()
283 * Method getNameSpaceURI.
285 * @return the namespace URI used when marshaling and unmarshaling as XML.
287 public java.lang.String getNameSpaceURI()
293 * Method getValidator.
295 * @return a specific validator for the class described by this
298 public org.exolab.castor.xml.TypeValidator getValidator()
306 * @return the XML Name for the Class being described.
308 public java.lang.String getXMLName()
314 * Method isElementDefinition.
316 * @return true if XML schema definition of this Class is that of a global
317 * element or element with anonymous type definition.
319 public boolean isElementDefinition()
321 return _elementDefinition;