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.CalcIdParam;
27 * Class CalcIdParamDescriptor.
29 * @version $Revision$ $Date$
31 public class CalcIdParamDescriptor
33 jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
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 CalcIdParamDescriptor()
67 setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
68 _nsURI = "www.jalview.org";
69 _xmlName = "calcIdParam";
70 _elementDefinition = true;
71 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
72 org.exolab.castor.mapping.FieldHandler handler = null;
73 org.exolab.castor.xml.FieldValidator fieldValidator = null;
74 // -- initialize attribute descriptors
77 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
78 java.lang.String.class, "_calcId", "calcId",
79 org.exolab.castor.xml.NodeType.Attribute);
80 desc.setImmutable(true);
81 handler = new org.exolab.castor.xml.XMLFieldHandler()
83 public java.lang.Object getValue(java.lang.Object object)
84 throws IllegalStateException
86 CalcIdParam target = (CalcIdParam) object;
87 return target.getCalcId();
90 public void setValue(java.lang.Object object, java.lang.Object value)
91 throws IllegalStateException, IllegalArgumentException
95 CalcIdParam target = (CalcIdParam) object;
96 target.setCalcId((java.lang.String) value);
97 } catch (java.lang.Exception ex)
99 throw new IllegalStateException(ex.toString());
103 public java.lang.Object newInstance(java.lang.Object parent)
108 desc.setHandler(handler);
109 desc.setRequired(true);
110 desc.setMultivalued(false);
111 addFieldDescriptor(desc);
113 // -- validation code for: _calcId
114 fieldValidator = new org.exolab.castor.xml.FieldValidator();
115 fieldValidator.setMinOccurs(1);
117 org.exolab.castor.xml.validators.StringValidator typeValidator;
118 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
119 fieldValidator.setValidator(typeValidator);
120 typeValidator.setWhiteSpace("preserve");
122 desc.setValidator(fieldValidator);
124 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
125 java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate",
126 org.exolab.castor.xml.NodeType.Attribute);
127 handler = new org.exolab.castor.xml.XMLFieldHandler()
129 public java.lang.Object getValue(java.lang.Object object)
130 throws IllegalStateException
132 CalcIdParam target = (CalcIdParam) object;
133 if (!target.hasNeedsUpdate())
137 return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE
138 : java.lang.Boolean.FALSE);
141 public void setValue(java.lang.Object object, java.lang.Object value)
142 throws IllegalStateException, IllegalArgumentException
146 CalcIdParam target = (CalcIdParam) object;
147 // if null, use delete method for optional primitives
150 target.deleteNeedsUpdate();
153 target.setNeedsUpdate(((java.lang.Boolean) value).booleanValue());
154 } catch (java.lang.Exception ex)
156 throw new IllegalStateException(ex.toString());
160 public java.lang.Object newInstance(java.lang.Object parent)
165 desc.setHandler(handler);
166 desc.setMultivalued(false);
167 addFieldDescriptor(desc);
169 // -- validation code for: _needsUpdate
170 fieldValidator = new org.exolab.castor.xml.FieldValidator();
172 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
173 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
174 fieldValidator.setValidator(typeValidator);
176 desc.setValidator(fieldValidator);
178 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
179 java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate",
180 org.exolab.castor.xml.NodeType.Attribute);
181 handler = new org.exolab.castor.xml.XMLFieldHandler()
183 public java.lang.Object getValue(java.lang.Object object)
184 throws IllegalStateException
186 CalcIdParam target = (CalcIdParam) object;
187 if (!target.hasAutoUpdate())
191 return (target.getAutoUpdate() ? java.lang.Boolean.TRUE
192 : java.lang.Boolean.FALSE);
195 public void setValue(java.lang.Object object, java.lang.Object value)
196 throws IllegalStateException, IllegalArgumentException
200 CalcIdParam target = (CalcIdParam) object;
201 // ignore null values for non optional primitives
207 target.setAutoUpdate(((java.lang.Boolean) value).booleanValue());
208 } catch (java.lang.Exception ex)
210 throw new IllegalStateException(ex.toString());
214 public java.lang.Object newInstance(java.lang.Object parent)
219 desc.setHandler(handler);
220 desc.setRequired(true);
221 desc.setMultivalued(false);
222 addFieldDescriptor(desc);
224 // -- validation code for: _autoUpdate
225 fieldValidator = new org.exolab.castor.xml.FieldValidator();
226 fieldValidator.setMinOccurs(1);
228 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
229 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
230 fieldValidator.setValidator(typeValidator);
232 desc.setValidator(fieldValidator);
233 // -- initialize element descriptors
242 * Method getAccessMode.
244 * @return the access mode specified for this class.
246 public org.exolab.castor.mapping.AccessMode getAccessMode()
252 * Method getIdentity.
254 * @return the identity field, null if this class has no identity.
256 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
258 return super.getIdentity();
262 * Method getJavaClass.
264 * @return the Java class represented by this descriptor.
266 public java.lang.Class getJavaClass()
268 return jalview.schemabinding.version2.CalcIdParam.class;
272 * Method getNameSpacePrefix.
274 * @return the namespace prefix to use when marshaling as XML.
276 public java.lang.String getNameSpacePrefix()
282 * Method getNameSpaceURI.
284 * @return the namespace URI used when marshaling and unmarshaling as XML.
286 public java.lang.String getNameSpaceURI()
292 * Method getValidator.
294 * @return a specific validator for the class described by this
297 public org.exolab.castor.xml.TypeValidator getValidator()
305 * @return the XML Name for the Class being described.
307 public java.lang.String getXMLName()
313 * Method isElementDefinition.
315 * @return true if XML schema definition of this Class is that of a global
316 * element or element with anonymous type definition.
318 public boolean isElementDefinition()
320 return _elementDefinition;