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.CalcIdParam;
30 * Class CalcIdParamDescriptor.
32 * @version $Revision$ $Date$
34 public class CalcIdParamDescriptor
36 jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
39 // --------------------------/
40 // - Class/Member Variables -/
41 // --------------------------/
44 * Field _elementDefinition.
46 private boolean _elementDefinition;
51 private java.lang.String _nsPrefix;
56 private java.lang.String _nsURI;
61 private java.lang.String _xmlName;
67 public CalcIdParamDescriptor()
70 setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
71 _nsURI = "www.jalview.org";
72 _xmlName = "calcIdParam";
73 _elementDefinition = true;
74 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
75 org.exolab.castor.mapping.FieldHandler handler = null;
76 org.exolab.castor.xml.FieldValidator fieldValidator = null;
77 // -- initialize attribute descriptors
80 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
81 java.lang.String.class, "_calcId", "calcId",
82 org.exolab.castor.xml.NodeType.Attribute);
83 desc.setImmutable(true);
84 handler = new org.exolab.castor.xml.XMLFieldHandler()
86 public java.lang.Object getValue(java.lang.Object object)
87 throws IllegalStateException
89 CalcIdParam target = (CalcIdParam) object;
90 return target.getCalcId();
93 public void setValue(java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
98 CalcIdParam target = (CalcIdParam) object;
99 target.setCalcId((java.lang.String) value);
100 } catch (java.lang.Exception ex)
102 throw new IllegalStateException(ex.toString());
106 public java.lang.Object newInstance(java.lang.Object parent)
111 desc.setHandler(handler);
112 desc.setRequired(true);
113 desc.setMultivalued(false);
114 addFieldDescriptor(desc);
116 // -- validation code for: _calcId
117 fieldValidator = new org.exolab.castor.xml.FieldValidator();
118 fieldValidator.setMinOccurs(1);
120 org.exolab.castor.xml.validators.StringValidator typeValidator;
121 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
122 fieldValidator.setValidator(typeValidator);
123 typeValidator.setWhiteSpace("preserve");
125 desc.setValidator(fieldValidator);
127 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
128 java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate",
129 org.exolab.castor.xml.NodeType.Attribute);
130 handler = new org.exolab.castor.xml.XMLFieldHandler()
132 public java.lang.Object getValue(java.lang.Object object)
133 throws IllegalStateException
135 CalcIdParam target = (CalcIdParam) object;
136 if (!target.hasNeedsUpdate())
140 return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE
141 : java.lang.Boolean.FALSE);
144 public void setValue(java.lang.Object object, java.lang.Object value)
145 throws IllegalStateException, IllegalArgumentException
149 CalcIdParam target = (CalcIdParam) object;
150 // if null, use delete method for optional primitives
153 target.deleteNeedsUpdate();
156 target.setNeedsUpdate(((java.lang.Boolean) value).booleanValue());
157 } catch (java.lang.Exception ex)
159 throw new IllegalStateException(ex.toString());
163 public java.lang.Object newInstance(java.lang.Object parent)
168 desc.setHandler(handler);
169 desc.setMultivalued(false);
170 addFieldDescriptor(desc);
172 // -- validation code for: _needsUpdate
173 fieldValidator = new org.exolab.castor.xml.FieldValidator();
175 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
176 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
177 fieldValidator.setValidator(typeValidator);
179 desc.setValidator(fieldValidator);
181 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
182 java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate",
183 org.exolab.castor.xml.NodeType.Attribute);
184 handler = new org.exolab.castor.xml.XMLFieldHandler()
186 public java.lang.Object getValue(java.lang.Object object)
187 throws IllegalStateException
189 CalcIdParam target = (CalcIdParam) object;
190 if (!target.hasAutoUpdate())
194 return (target.getAutoUpdate() ? java.lang.Boolean.TRUE
195 : java.lang.Boolean.FALSE);
198 public void setValue(java.lang.Object object, java.lang.Object value)
199 throws IllegalStateException, IllegalArgumentException
203 CalcIdParam target = (CalcIdParam) object;
204 // ignore null values for non optional primitives
210 target.setAutoUpdate(((java.lang.Boolean) value).booleanValue());
211 } catch (java.lang.Exception ex)
213 throw new IllegalStateException(ex.toString());
217 public java.lang.Object newInstance(java.lang.Object parent)
222 desc.setHandler(handler);
223 desc.setRequired(true);
224 desc.setMultivalued(false);
225 addFieldDescriptor(desc);
227 // -- validation code for: _autoUpdate
228 fieldValidator = new org.exolab.castor.xml.FieldValidator();
229 fieldValidator.setMinOccurs(1);
231 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
232 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
233 fieldValidator.setValidator(typeValidator);
235 desc.setValidator(fieldValidator);
236 // -- initialize element descriptors
245 * Method getAccessMode.
247 * @return the access mode specified for this class.
249 public org.exolab.castor.mapping.AccessMode getAccessMode()
255 * Method getIdentity.
257 * @return the identity field, null if this class has no identity.
259 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
261 return super.getIdentity();
265 * Method getJavaClass.
267 * @return the Java class represented by this descriptor.
269 public java.lang.Class getJavaClass()
271 return jalview.schemabinding.version2.CalcIdParam.class;
275 * Method getNameSpacePrefix.
277 * @return the namespace prefix to use when marshaling as XML.
279 public java.lang.String getNameSpacePrefix()
285 * Method getNameSpaceURI.
287 * @return the namespace URI used when marshaling and unmarshaling as XML.
289 public java.lang.String getNameSpaceURI()
295 * Method getValidator.
297 * @return a specific validator for the class described by this
300 public org.exolab.castor.xml.TypeValidator getValidator()
308 * @return the XML Name for the Class being described.
310 public java.lang.String getXMLName()
316 * Method isElementDefinition.
318 * @return true if XML schema definition of this Class is that of a global
319 * element or element with anonymous type definition.
321 public boolean isElementDefinition()
323 return _elementDefinition;