620de0400cc24791614135f321df4027af173ad4
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / PdbidsDescriptor.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
3  * Copyright (C) 2008 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\r
33         jalview.schemabinding.version2.descriptors.PdbentryDescriptor\r
34 {\r
35 \r
36   // --------------------------/\r
37   // - Class/Member Variables -/\r
38   // --------------------------/\r
39 \r
40   /**\r
41    * Field _elementDefinition.\r
42    */\r
43   private boolean _elementDefinition;\r
44 \r
45   /**\r
46    * Field _nsPrefix.\r
47    */\r
48   private java.lang.String _nsPrefix;\r
49 \r
50   /**\r
51    * Field _nsURI.\r
52    */\r
53   private java.lang.String _nsURI;\r
54 \r
55   /**\r
56    * Field _xmlName.\r
57    */\r
58   private java.lang.String _xmlName;\r
59 \r
60   // ----------------/\r
61   // - Constructors -/\r
62   // ----------------/\r
63 \r
64   public PdbidsDescriptor()\r
65   {\r
66     super();\r
67     setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.PdbentryDescriptor());\r
68     _nsURI = "www.jalview.org";\r
69     _xmlName = "pdbids";\r
70     _elementDefinition = true;\r
71 \r
72     // -- set grouping compositor\r
73     setCompositorAsSequence();\r
74     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
75     org.exolab.castor.mapping.FieldHandler handler = null;\r
76     org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
77     // -- initialize attribute descriptors\r
78 \r
79     // -- initialize element descriptors\r
80 \r
81     // -- _structureStateList\r
82     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
83             jalview.schemabinding.version2.StructureState.class,\r
84             "_structureStateList", "structureState",\r
85             org.exolab.castor.xml.NodeType.Element);\r
86     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
87     {\r
88       public java.lang.Object getValue(java.lang.Object object)\r
89               throws IllegalStateException\r
90       {\r
91         Pdbids target = (Pdbids) object;\r
92         return target.getStructureState();\r
93       }\r
94 \r
95       public void setValue(java.lang.Object object, java.lang.Object value)\r
96               throws IllegalStateException, IllegalArgumentException\r
97       {\r
98         try\r
99         {\r
100           Pdbids target = (Pdbids) object;\r
101           target\r
102                   .addStructureState((jalview.schemabinding.version2.StructureState) value);\r
103         } catch (java.lang.Exception ex)\r
104         {\r
105           throw new IllegalStateException(ex.toString());\r
106         }\r
107       }\r
108 \r
109       public void resetValue(Object object) throws IllegalStateException,\r
110               IllegalArgumentException\r
111       {\r
112         try\r
113         {\r
114           Pdbids target = (Pdbids) object;\r
115           target.removeAllStructureState();\r
116         } catch (java.lang.Exception ex)\r
117         {\r
118           throw new IllegalStateException(ex.toString());\r
119         }\r
120       }\r
121 \r
122       public java.lang.Object newInstance(java.lang.Object parent)\r
123       {\r
124         return new jalview.schemabinding.version2.StructureState();\r
125       }\r
126     };\r
127     desc.setHandler(handler);\r
128     desc.setNameSpaceURI("www.jalview.org");\r
129     desc.setMultivalued(true);\r
130     addFieldDescriptor(desc);\r
131 \r
132     // -- validation code for: _structureStateList\r
133     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
134     fieldValidator.setMinOccurs(0);\r
135     { // -- local scope\r
136     }\r
137     desc.setValidator(fieldValidator);\r
138   }\r
139 \r
140   // -----------/\r
141   // - Methods -/\r
142   // -----------/\r
143 \r
144   /**\r
145    * Method getAccessMode.\r
146    * \r
147    * @return the access mode specified for this class.\r
148    */\r
149   public org.exolab.castor.mapping.AccessMode getAccessMode()\r
150   {\r
151     return null;\r
152   }\r
153 \r
154   /**\r
155    * Method getIdentity.\r
156    * \r
157    * @return the identity field, null if this class has no identity.\r
158    */\r
159   public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
160   {\r
161     return super.getIdentity();\r
162   }\r
163 \r
164   /**\r
165    * Method getJavaClass.\r
166    * \r
167    * @return the Java class represented by this descriptor.\r
168    */\r
169   public java.lang.Class getJavaClass()\r
170   {\r
171     return jalview.schemabinding.version2.Pdbids.class;\r
172   }\r
173 \r
174   /**\r
175    * Method getNameSpacePrefix.\r
176    * \r
177    * @return the namespace prefix to use when marshaling as XML.\r
178    */\r
179   public java.lang.String getNameSpacePrefix()\r
180   {\r
181     return _nsPrefix;\r
182   }\r
183 \r
184   /**\r
185    * Method getNameSpaceURI.\r
186    * \r
187    * @return the namespace URI used when marshaling and unmarshaling as XML.\r
188    */\r
189   public java.lang.String getNameSpaceURI()\r
190   {\r
191     return _nsURI;\r
192   }\r
193 \r
194   /**\r
195    * Method getValidator.\r
196    * \r
197    * @return a specific validator for the class described by this\r
198    *         ClassDescriptor.\r
199    */\r
200   public org.exolab.castor.xml.TypeValidator getValidator()\r
201   {\r
202     return this;\r
203   }\r
204 \r
205   /**\r
206    * Method getXMLName.\r
207    * \r
208    * @return the XML Name for the Class being described.\r
209    */\r
210   public java.lang.String getXMLName()\r
211   {\r
212     return _xmlName;\r
213   }\r
214 \r
215   /**\r
216    * Method isElementDefinition.\r
217    * \r
218    * @return true if XML schema definition of this Class is that of a global\r
219    *         element or element with anonymous type definition.\r
220    */\r
221   public boolean isElementDefinition()\r
222   {\r
223     return _elementDefinition;\r
224   }\r
225 \r
226 }\r