1ffbb1e853860b44af1734dc717d4ca5694ad941
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / PdbentryItemDescriptor.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.PdbentryItem;\r
26 \r
27 /**\r
28  * Class PdbentryItemDescriptor.\r
29  * \r
30  * @version $Revision$ $Date$\r
31  */\r
32 public class PdbentryItemDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\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 PdbentryItemDescriptor() {\r
65         super();\r
66         _nsURI = "www.jalview.org";\r
67         _xmlName = "pdbentry";\r
68         _elementDefinition = false;\r
69         \r
70         //-- set grouping compositor\r
71         setCompositorAsSequence();\r
72         org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
73         org.exolab.castor.mapping.FieldHandler             handler        = null;\r
74         org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
75         //-- initialize attribute descriptors\r
76         \r
77         //-- initialize element descriptors\r
78         \r
79         //-- _propertyList\r
80         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
81         handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
82             public java.lang.Object getValue( java.lang.Object object ) \r
83                 throws IllegalStateException\r
84             {\r
85                 PdbentryItem target = (PdbentryItem) object;\r
86                 return target.getProperty();\r
87             }\r
88             public void setValue( java.lang.Object object, java.lang.Object value) \r
89                 throws IllegalStateException, IllegalArgumentException\r
90             {\r
91                 try {\r
92                     PdbentryItem target = (PdbentryItem) object;\r
93                     target.addProperty( (jalview.schemabinding.version2.Property) value);\r
94                 } catch (java.lang.Exception ex) {\r
95                     throw new IllegalStateException(ex.toString());\r
96                 }\r
97             }\r
98             public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
99                 try {\r
100                     PdbentryItem target = (PdbentryItem) object;\r
101                     target.removeAllProperty();\r
102                 } catch (java.lang.Exception ex) {\r
103                     throw new IllegalStateException(ex.toString());\r
104                 }\r
105             }\r
106             public java.lang.Object newInstance(java.lang.Object parent) {\r
107                 return new jalview.schemabinding.version2.Property();\r
108             }\r
109         };\r
110         desc.setHandler(handler);\r
111         desc.setNameSpaceURI("www.jalview.org");\r
112         desc.setMultivalued(true);\r
113         addFieldDescriptor(desc);\r
114         \r
115         //-- validation code for: _propertyList\r
116         fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
117         fieldValidator.setMinOccurs(0);\r
118         { //-- local scope\r
119         }\r
120         desc.setValidator(fieldValidator);\r
121     }\r
122 \r
123 \r
124       //-----------/\r
125      //- Methods -/\r
126     //-----------/\r
127 \r
128     /**\r
129      * Method getAccessMode.\r
130      * \r
131      * @return the access mode specified for this class.\r
132      */\r
133     public org.exolab.castor.mapping.AccessMode getAccessMode(\r
134     ) {\r
135         return null;\r
136     }\r
137 \r
138     /**\r
139      * Method getIdentity.\r
140      * \r
141      * @return the identity field, null if this class has no\r
142      * identity.\r
143      */\r
144     public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
145     ) {\r
146         return super.getIdentity();\r
147     }\r
148 \r
149     /**\r
150      * Method getJavaClass.\r
151      * \r
152      * @return the Java class represented by this descriptor.\r
153      */\r
154     public java.lang.Class getJavaClass(\r
155     ) {\r
156         return jalview.schemabinding.version2.PdbentryItem.class;\r
157     }\r
158 \r
159     /**\r
160      * Method getNameSpacePrefix.\r
161      * \r
162      * @return the namespace prefix to use when marshaling as XML.\r
163      */\r
164     public java.lang.String getNameSpacePrefix(\r
165     ) {\r
166         return _nsPrefix;\r
167     }\r
168 \r
169     /**\r
170      * Method getNameSpaceURI.\r
171      * \r
172      * @return the namespace URI used when marshaling and\r
173      * unmarshaling as XML.\r
174      */\r
175     public java.lang.String getNameSpaceURI(\r
176     ) {\r
177         return _nsURI;\r
178     }\r
179 \r
180     /**\r
181      * Method getValidator.\r
182      * \r
183      * @return a specific validator for the class described by this\r
184      * ClassDescriptor.\r
185      */\r
186     public org.exolab.castor.xml.TypeValidator getValidator(\r
187     ) {\r
188         return this;\r
189     }\r
190 \r
191     /**\r
192      * Method getXMLName.\r
193      * \r
194      * @return the XML Name for the Class being described.\r
195      */\r
196     public java.lang.String getXMLName(\r
197     ) {\r
198         return _xmlName;\r
199     }\r
200 \r
201     /**\r
202      * Method isElementDefinition.\r
203      * \r
204      * @return true if XML schema definition of this Class is that\r
205      * of a global\r
206      * element or element with anonymous type definition.\r
207      */\r
208     public boolean isElementDefinition(\r
209     ) {\r
210         return _elementDefinition;\r
211     }\r
212 \r
213 }\r