View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.mapping.xml.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.mapping.xml.ClassChoice;
15  
16  /**
17   * Class ClassChoiceDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class ClassChoiceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
22  
23  
24        //--------------------------/
25       //- Class/Member Variables -/
26      //--------------------------/
27  
28      /**
29       * Field _elementDefinition.
30       */
31      private boolean _elementDefinition;
32  
33      /**
34       * Field _nsPrefix.
35       */
36      private java.lang.String _nsPrefix;
37  
38      /**
39       * Field _nsURI.
40       */
41      private java.lang.String _nsURI;
42  
43      /**
44       * Field _xmlName.
45       */
46      private java.lang.String _xmlName;
47  
48      /**
49       * Field _identity.
50       */
51      private org.exolab.castor.xml.XMLFieldDescriptor _identity;
52  
53  
54        //----------------/
55       //- Constructors -/
56      //----------------/
57  
58      public ClassChoiceDescriptor() {
59          super();
60          _nsURI = "http://castor.exolab.org/";
61          _elementDefinition = false;
62  
63          //-- set grouping compositor
64          setCompositorAsChoice();
65          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
66          org.exolab.castor.mapping.FieldHandler             handler        = null;
67          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
68          //-- initialize attribute descriptors
69  
70          //-- initialize element descriptors
71  
72          //-- _fieldMappingList
73          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.FieldMapping.class, "_fieldMappingList", "field", org.exolab.castor.xml.NodeType.Element);
74          handler = new org.exolab.castor.xml.XMLFieldHandler() {
75              @Override
76              public java.lang.Object getValue( java.lang.Object object ) 
77                  throws IllegalStateException
78              {
79                  ClassChoice target = (ClassChoice) object;
80                  return target.getFieldMapping();
81              }
82              @Override
83              public void setValue( java.lang.Object object, java.lang.Object value) 
84                  throws IllegalStateException, IllegalArgumentException
85              {
86                  try {
87                      ClassChoice target = (ClassChoice) object;
88                      target.addFieldMapping( (org.exolab.castor.mapping.xml.FieldMapping) value);
89                  } catch (java.lang.Exception ex) {
90                      throw new IllegalStateException(ex.toString());
91                  }
92              }
93              public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
94                  try {
95                      ClassChoice target = (ClassChoice) object;
96                      target.removeAllFieldMapping();
97                  } catch (java.lang.Exception ex) {
98                      throw new IllegalStateException(ex.toString());
99                  }
100             }
101             @Override
102             @SuppressWarnings("unused")
103             public java.lang.Object newInstance(java.lang.Object parent) {
104                 return null;
105             }
106         };
107         desc.setSchemaType("list");
108         desc.setComponentType("org.exolab.castor.mapping.xml.FieldMapping");
109         desc.setHandler(handler);
110         desc.setNameSpaceURI("http://castor.exolab.org/");
111         desc.setMultivalued(true);
112         addFieldDescriptor(desc);
113         addSequenceElement(desc);
114 
115         //-- validation code for: _fieldMappingList
116         fieldValidator = new org.exolab.castor.xml.FieldValidator();
117         fieldValidator.setMinOccurs(0);
118         { //-- local scope
119         }
120         desc.setValidator(fieldValidator);
121         //-- _containerList
122         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.Container.class, "_containerList", "container", org.exolab.castor.xml.NodeType.Element);
123         handler = new org.exolab.castor.xml.XMLFieldHandler() {
124             @Override
125             public java.lang.Object getValue( java.lang.Object object ) 
126                 throws IllegalStateException
127             {
128                 ClassChoice target = (ClassChoice) object;
129                 return target.getContainer();
130             }
131             @Override
132             public void setValue( java.lang.Object object, java.lang.Object value) 
133                 throws IllegalStateException, IllegalArgumentException
134             {
135                 try {
136                     ClassChoice target = (ClassChoice) object;
137                     target.addContainer( (org.exolab.castor.mapping.xml.Container) value);
138                 } catch (java.lang.Exception ex) {
139                     throw new IllegalStateException(ex.toString());
140                 }
141             }
142             public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
143                 try {
144                     ClassChoice target = (ClassChoice) object;
145                     target.removeAllContainer();
146                 } catch (java.lang.Exception ex) {
147                     throw new IllegalStateException(ex.toString());
148                 }
149             }
150             @Override
151             @SuppressWarnings("unused")
152             public java.lang.Object newInstance(java.lang.Object parent) {
153                 return null;
154             }
155         };
156         desc.setSchemaType("list");
157         desc.setComponentType("org.exolab.castor.mapping.xml.Container");
158         desc.setHandler(handler);
159         desc.setNameSpaceURI("http://castor.exolab.org/");
160         desc.setMultivalued(true);
161         addFieldDescriptor(desc);
162         addSequenceElement(desc);
163 
164         //-- validation code for: _containerList
165         fieldValidator = new org.exolab.castor.xml.FieldValidator();
166         fieldValidator.setMinOccurs(0);
167         { //-- local scope
168         }
169         desc.setValidator(fieldValidator);
170     }
171 
172 
173       //-----------/
174      //- Methods -/
175     //-----------/
176 
177     /**
178      * Method getAccessMode.
179      * 
180      * @return the access mode specified for this class.
181      */
182     @Override()
183     public org.exolab.castor.mapping.AccessMode getAccessMode(
184     ) {
185         return null;
186     }
187 
188     /**
189      * Method getIdentity.
190      * 
191      * @return the identity field, null if this class has no
192      * identity.
193      */
194     @Override()
195     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
196     ) {
197         return _identity;
198     }
199 
200     /**
201      * Method getJavaClass.
202      * 
203      * @return the Java class represented by this descriptor.
204      */
205     @Override()
206     public java.lang.Class getJavaClass(
207     ) {
208         return org.exolab.castor.mapping.xml.ClassChoice.class;
209     }
210 
211     /**
212      * Method getNameSpacePrefix.
213      * 
214      * @return the namespace prefix to use when marshaling as XML.
215      */
216     @Override()
217     public java.lang.String getNameSpacePrefix(
218     ) {
219         return _nsPrefix;
220     }
221 
222     /**
223      * Method getNameSpaceURI.
224      * 
225      * @return the namespace URI used when marshaling and
226      * unmarshaling as XML.
227      */
228     @Override()
229     public java.lang.String getNameSpaceURI(
230     ) {
231         return _nsURI;
232     }
233 
234     /**
235      * Method getValidator.
236      * 
237      * @return a specific validator for the class described by this
238      * ClassDescriptor.
239      */
240     @Override()
241     public org.exolab.castor.xml.TypeValidator getValidator(
242     ) {
243         return this;
244     }
245 
246     /**
247      * Method getXMLName.
248      * 
249      * @return the XML Name for the Class being described.
250      */
251     @Override()
252     public java.lang.String getXMLName(
253     ) {
254         return _xmlName;
255     }
256 
257     /**
258      * Method isElementDefinition.
259      * 
260      * @return true if XML schema definition of this Class is that
261      * of a global
262      * element or element with anonymous type definition.
263      */
264     public boolean isElementDefinition(
265     ) {
266         return _elementDefinition;
267     }
268 
269 }