JAL-1620 version bump and release notes
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / PropertyDescriptor.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
11  *  
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.
16  * 
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.
20  */
21 package jalview.schemabinding.version2.descriptors;
22
23   //---------------------------------/
24  //- Imported classes and packages -/
25 //---------------------------------/
26
27 import jalview.schemabinding.version2.Property;
28
29 /**
30  * Class PropertyDescriptor.
31  * 
32  * @version $Revision$ $Date$
33  */
34 public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
35
36
37       //--------------------------/
38      //- Class/Member Variables -/
39     //--------------------------/
40
41     /**
42      * Field _elementDefinition.
43      */
44     private boolean _elementDefinition;
45
46     /**
47      * Field _nsPrefix.
48      */
49     private java.lang.String _nsPrefix;
50
51     /**
52      * Field _nsURI.
53      */
54     private java.lang.String _nsURI;
55
56     /**
57      * Field _xmlName.
58      */
59     private java.lang.String _xmlName;
60
61
62       //----------------/
63      //- Constructors -/
64     //----------------/
65
66     public PropertyDescriptor() {
67         super();
68         _nsURI = "www.jalview.org";
69         _xmlName = "property";
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
75         
76         //-- _name
77         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
78         desc.setImmutable(true);
79         handler = new org.exolab.castor.xml.XMLFieldHandler() {
80             public java.lang.Object getValue( java.lang.Object object ) 
81                 throws IllegalStateException
82             {
83                 Property target = (Property) object;
84                 return target.getName();
85             }
86             public void setValue( java.lang.Object object, java.lang.Object value) 
87                 throws IllegalStateException, IllegalArgumentException
88             {
89                 try {
90                     Property target = (Property) object;
91                     target.setName( (java.lang.String) value);
92                 } catch (java.lang.Exception ex) {
93                     throw new IllegalStateException(ex.toString());
94                 }
95             }
96             public java.lang.Object newInstance(java.lang.Object parent) {
97                 return null;
98             }
99         };
100         desc.setHandler(handler);
101         desc.setRequired(true);
102         desc.setMultivalued(false);
103         addFieldDescriptor(desc);
104         
105         //-- validation code for: _name
106         fieldValidator = new org.exolab.castor.xml.FieldValidator();
107         fieldValidator.setMinOccurs(1);
108         { //-- local scope
109             org.exolab.castor.xml.validators.StringValidator typeValidator;
110             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
111             fieldValidator.setValidator(typeValidator);
112             typeValidator.setWhiteSpace("preserve");
113         }
114         desc.setValidator(fieldValidator);
115         //-- _value
116         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);
117         desc.setImmutable(true);
118         handler = new org.exolab.castor.xml.XMLFieldHandler() {
119             public java.lang.Object getValue( java.lang.Object object ) 
120                 throws IllegalStateException
121             {
122                 Property target = (Property) object;
123                 return target.getValue();
124             }
125             public void setValue( java.lang.Object object, java.lang.Object value) 
126                 throws IllegalStateException, IllegalArgumentException
127             {
128                 try {
129                     Property target = (Property) object;
130                     target.setValue( (java.lang.String) value);
131                 } catch (java.lang.Exception ex) {
132                     throw new IllegalStateException(ex.toString());
133                 }
134             }
135             public java.lang.Object newInstance(java.lang.Object parent) {
136                 return null;
137             }
138         };
139         desc.setHandler(handler);
140         desc.setRequired(true);
141         desc.setMultivalued(false);
142         addFieldDescriptor(desc);
143         
144         //-- validation code for: _value
145         fieldValidator = new org.exolab.castor.xml.FieldValidator();
146         fieldValidator.setMinOccurs(1);
147         { //-- local scope
148             org.exolab.castor.xml.validators.StringValidator typeValidator;
149             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
150             fieldValidator.setValidator(typeValidator);
151             typeValidator.setWhiteSpace("preserve");
152         }
153         desc.setValidator(fieldValidator);
154         //-- initialize element descriptors
155         
156     }
157
158
159       //-----------/
160      //- Methods -/
161     //-----------/
162
163     /**
164      * Method getAccessMode.
165      * 
166      * @return the access mode specified for this class.
167      */
168     public org.exolab.castor.mapping.AccessMode getAccessMode(
169     ) {
170         return null;
171     }
172
173     /**
174      * Method getIdentity.
175      * 
176      * @return the identity field, null if this class has no
177      * identity.
178      */
179     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
180     ) {
181         return super.getIdentity();
182     }
183
184     /**
185      * Method getJavaClass.
186      * 
187      * @return the Java class represented by this descriptor.
188      */
189     public java.lang.Class getJavaClass(
190     ) {
191         return jalview.schemabinding.version2.Property.class;
192     }
193
194     /**
195      * Method getNameSpacePrefix.
196      * 
197      * @return the namespace prefix to use when marshaling as XML.
198      */
199     public java.lang.String getNameSpacePrefix(
200     ) {
201         return _nsPrefix;
202     }
203
204     /**
205      * Method getNameSpaceURI.
206      * 
207      * @return the namespace URI used when marshaling and
208      * unmarshaling as XML.
209      */
210     public java.lang.String getNameSpaceURI(
211     ) {
212         return _nsURI;
213     }
214
215     /**
216      * Method getValidator.
217      * 
218      * @return a specific validator for the class described by this
219      * ClassDescriptor.
220      */
221     public org.exolab.castor.xml.TypeValidator getValidator(
222     ) {
223         return this;
224     }
225
226     /**
227      * Method getXMLName.
228      * 
229      * @return the XML Name for the Class being described.
230      */
231     public java.lang.String getXMLName(
232     ) {
233         return _xmlName;
234     }
235
236     /**
237      * Method isElementDefinition.
238      * 
239      * @return true if XML schema definition of this Class is that
240      * of a global
241      * element or element with anonymous type definition.
242      */
243     public boolean isElementDefinition(
244     ) {
245         return _elementDefinition;
246     }
247
248 }