apply gpl development license
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / PdbidsDescriptor.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2.descriptors;\r
20 \r
21   //---------------------------------/\r
22  //- Imported classes and packages -/\r
23 //---------------------------------/\r
24 \r
25 import jalview.schemabinding.version2.Pdbids;\r
26 \r
27 /**\r
28  * Class PdbidsDescriptor.\r
29  * \r
30  * @version $Revision$ $Date$\r
31  */\r
32 public class PdbidsDescriptor extends jalview.schemabinding.version2.descriptors.PdbentryDescriptor {\r
33 \r
34 \r
35       //--------------------------/\r
36      //- Class/Member Variables -/\r
37     //--------------------------/\r
38 \r
39     /**\r
40      * Field _elementDefinition.\r
41      */\r
42     private boolean _elementDefinition;\r
43 \r
44     /**\r
45      * Field _nsPrefix.\r
46      */\r
47     private java.lang.String _nsPrefix;\r
48 \r
49     /**\r
50      * Field _nsURI.\r
51      */\r
52     private java.lang.String _nsURI;\r
53 \r
54     /**\r
55      * Field _xmlName.\r
56      */\r
57     private java.lang.String _xmlName;\r
58 \r
59 \r
60       //----------------/\r
61      //- Constructors -/\r
62     //----------------/\r
63 \r
64     public PdbidsDescriptor() {\r
65         super();\r
66         setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.PdbentryDescriptor());\r
67         _nsURI = "www.jalview.org";\r
68         _xmlName = "pdbids";\r
69         _elementDefinition = true;\r
70         \r
71         //-- set grouping compositor\r
72         setCompositorAsSequence();\r
73         org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
74         org.exolab.castor.mapping.FieldHandler             handler        = null;\r
75         org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
76         //-- initialize attribute descriptors\r
77         \r
78         //-- initialize element descriptors\r
79         \r
80         //-- _structureStateList\r
81         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.StructureState.class, "_structureStateList", "structureState", org.exolab.castor.xml.NodeType.Element);\r
82         handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
83             public java.lang.Object getValue( java.lang.Object object ) \r
84                 throws IllegalStateException\r
85             {\r
86                 Pdbids target = (Pdbids) object;\r
87                 return target.getStructureState();\r
88             }\r
89             public void setValue( java.lang.Object object, java.lang.Object value) \r
90                 throws IllegalStateException, IllegalArgumentException\r
91             {\r
92                 try {\r
93                     Pdbids target = (Pdbids) object;\r
94                     target.addStructureState( (jalview.schemabinding.version2.StructureState) value);\r
95                 } catch (java.lang.Exception ex) {\r
96                     throw new IllegalStateException(ex.toString());\r
97                 }\r
98             }\r
99             public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
100                 try {\r
101                     Pdbids target = (Pdbids) object;\r
102                     target.removeAllStructureState();\r
103                 } catch (java.lang.Exception ex) {\r
104                     throw new IllegalStateException(ex.toString());\r
105                 }\r
106             }\r
107             public java.lang.Object newInstance(java.lang.Object parent) {\r
108                 return new jalview.schemabinding.version2.StructureState();\r
109             }\r
110         };\r
111         desc.setHandler(handler);\r
112         desc.setNameSpaceURI("www.jalview.org");\r
113         desc.setMultivalued(true);\r
114         addFieldDescriptor(desc);\r
115         \r
116         //-- validation code for: _structureStateList\r
117         fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
118         fieldValidator.setMinOccurs(0);\r
119         { //-- local scope\r
120         }\r
121         desc.setValidator(fieldValidator);\r
122     }\r
123 \r
124 \r
125       //-----------/\r
126      //- Methods -/\r
127     //-----------/\r
128 \r
129     /**\r
130      * Method getAccessMode.\r
131      * \r
132      * @return the access mode specified for this class.\r
133      */\r
134     public org.exolab.castor.mapping.AccessMode getAccessMode(\r
135     ) {\r
136         return null;\r
137     }\r
138 \r
139     /**\r
140      * Method getIdentity.\r
141      * \r
142      * @return the identity field, null if this class has no\r
143      * identity.\r
144      */\r
145     public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
146     ) {\r
147         return super.getIdentity();\r
148     }\r
149 \r
150     /**\r
151      * Method getJavaClass.\r
152      * \r
153      * @return the Java class represented by this descriptor.\r
154      */\r
155     public java.lang.Class getJavaClass(\r
156     ) {\r
157         return jalview.schemabinding.version2.Pdbids.class;\r
158     }\r
159 \r
160     /**\r
161      * Method getNameSpacePrefix.\r
162      * \r
163      * @return the namespace prefix to use when marshaling as XML.\r
164      */\r
165     public java.lang.String getNameSpacePrefix(\r
166     ) {\r
167         return _nsPrefix;\r
168     }\r
169 \r
170     /**\r
171      * Method getNameSpaceURI.\r
172      * \r
173      * @return the namespace URI used when marshaling and\r
174      * unmarshaling as XML.\r
175      */\r
176     public java.lang.String getNameSpaceURI(\r
177     ) {\r
178         return _nsURI;\r
179     }\r
180 \r
181     /**\r
182      * Method getValidator.\r
183      * \r
184      * @return a specific validator for the class described by this\r
185      * ClassDescriptor.\r
186      */\r
187     public org.exolab.castor.xml.TypeValidator getValidator(\r
188     ) {\r
189         return this;\r
190     }\r
191 \r
192     /**\r
193      * Method getXMLName.\r
194      * \r
195      * @return the XML Name for the Class being described.\r
196      */\r
197     public java.lang.String getXMLName(\r
198     ) {\r
199         return _xmlName;\r
200     }\r
201 \r
202     /**\r
203      * Method isElementDefinition.\r
204      * \r
205      * @return true if XML schema definition of this Class is that\r
206      * of a global\r
207      * element or element with anonymous type definition.\r
208      */\r
209     public boolean isElementDefinition(\r
210     ) {\r
211         return _elementDefinition;\r
212     }\r
213 \r
214 }\r