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.tests.framework.testDescriptor.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.tests.framework.testDescriptor.FailureType;
15  
16  /**
17   * Class FailureTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class FailureTypeDescriptor 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 FailureTypeDescriptor() {
59          super();
60          _nsURI = "http://castor.exolab.org/Test";
61          _xmlName = "FailureType";
62          _elementDefinition = false;
63          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
64          org.exolab.castor.mapping.FieldHandler             handler        = null;
65          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
66          //-- _content
67          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
68          handler = new org.exolab.castor.xml.XMLFieldHandler() {
69              public java.lang.Object getValue( java.lang.Object object ) 
70                  throws IllegalStateException
71              {
72                  FailureType target = (FailureType) object;
73                  if (!target.hasContent()) { return null; }
74                  return (target.getContent() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
75              }
76              public void setValue( java.lang.Object object, java.lang.Object value) 
77                  throws IllegalStateException, IllegalArgumentException
78              {
79                  try {
80                      FailureType target = (FailureType) object;
81                      // if null, use delete method for optional primitives 
82                      if (value == null) {
83                          target.deleteContent();
84                          return;
85                      }
86                      target.setContent( ((java.lang.Boolean) value).booleanValue());
87                  } catch (java.lang.Exception ex) {
88                      throw new IllegalStateException(ex.toString());
89                  }
90              }
91              public java.lang.Object newInstance(java.lang.Object parent) {
92                  return null;
93              }
94          };
95          desc.setSchemaType("boolean");
96          desc.setHandler(handler);
97          addFieldDescriptor(desc);
98  
99          //-- validation code for: _content
100         fieldValidator = new org.exolab.castor.xml.FieldValidator();
101         { //-- local scope
102             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
103             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
104             fieldValidator.setValidator(typeValidator);
105         }
106         desc.setValidator(fieldValidator);
107         //-- initialize attribute descriptors
108 
109         //-- _exception
110         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_exception", "exception", org.exolab.castor.xml.NodeType.Attribute);
111         desc.setImmutable(true);
112         handler = new org.exolab.castor.xml.XMLFieldHandler() {
113             public java.lang.Object getValue( java.lang.Object object ) 
114                 throws IllegalStateException
115             {
116                 FailureType target = (FailureType) object;
117                 return target.getException();
118             }
119             public void setValue( java.lang.Object object, java.lang.Object value) 
120                 throws IllegalStateException, IllegalArgumentException
121             {
122                 try {
123                     FailureType target = (FailureType) object;
124                     target.setException( (java.lang.String) value);
125                 } catch (java.lang.Exception ex) {
126                     throw new IllegalStateException(ex.toString());
127                 }
128             }
129             public java.lang.Object newInstance(java.lang.Object parent) {
130                 return null;
131             }
132         };
133         desc.setSchemaType("string");
134         desc.setHandler(handler);
135         desc.setMultivalued(false);
136         addFieldDescriptor(desc);
137 
138         //-- validation code for: _exception
139         fieldValidator = new org.exolab.castor.xml.FieldValidator();
140         { //-- local scope
141             org.exolab.castor.xml.validators.StringValidator typeValidator;
142             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
143             fieldValidator.setValidator(typeValidator);
144             typeValidator.setWhiteSpace("preserve");
145         }
146         desc.setValidator(fieldValidator);
147         //-- _failureStep
148         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType.class, "_failureStep", "FailureStep", org.exolab.castor.xml.NodeType.Attribute);
149         handler = new org.exolab.castor.xml.XMLFieldHandler() {
150             public java.lang.Object getValue( java.lang.Object object ) 
151                 throws IllegalStateException
152             {
153                 FailureType target = (FailureType) object;
154                 return target.getFailureStep();
155             }
156             public void setValue( java.lang.Object object, java.lang.Object value) 
157                 throws IllegalStateException, IllegalArgumentException
158             {
159                 try {
160                     FailureType target = (FailureType) object;
161                     target.setFailureStep( (org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType) value);
162                 } catch (java.lang.Exception ex) {
163                     throw new IllegalStateException(ex.toString());
164                 }
165             }
166             public java.lang.Object newInstance(java.lang.Object parent) {
167                 return null;
168             }
169         };
170         handler = new org.exolab.castor.xml.handlers.EnumFieldHandler(org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType.class, handler);
171         desc.setImmutable(true);
172         desc.setSchemaType("FailureStepType");
173         desc.setHandler(handler);
174         desc.setMultivalued(false);
175         addFieldDescriptor(desc);
176 
177         //-- validation code for: _failureStep
178         fieldValidator = new org.exolab.castor.xml.FieldValidator();
179         { //-- local scope
180         }
181         desc.setValidator(fieldValidator);
182         //-- initialize element descriptors
183 
184     }
185 
186 
187       //-----------/
188      //- Methods -/
189     //-----------/
190 
191     /**
192      * Method getAccessMode.
193      * 
194      * @return the access mode specified for this class.
195      */
196     public org.exolab.castor.mapping.AccessMode getAccessMode(
197     ) {
198         return null;
199     }
200 
201     /**
202      * Method getIdentity.
203      * 
204      * @return the identity field, null if this class has no
205      * identity.
206      */
207     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
208     ) {
209         return _identity;
210     }
211 
212     /**
213      * Method getJavaClass.
214      * 
215      * @return the Java class represented by this descriptor.
216      */
217     public java.lang.Class getJavaClass(
218     ) {
219         return org.exolab.castor.tests.framework.testDescriptor.FailureType.class;
220     }
221 
222     /**
223      * Method getNameSpacePrefix.
224      * 
225      * @return the namespace prefix to use when marshaling as XML.
226      */
227     public java.lang.String getNameSpacePrefix(
228     ) {
229         return _nsPrefix;
230     }
231 
232     /**
233      * Method getNameSpaceURI.
234      * 
235      * @return the namespace URI used when marshaling and
236      * unmarshaling as XML.
237      */
238     public java.lang.String getNameSpaceURI(
239     ) {
240         return _nsURI;
241     }
242 
243     /**
244      * Method getValidator.
245      * 
246      * @return a specific validator for the class described by this
247      * ClassDescriptor.
248      */
249     public org.exolab.castor.xml.TypeValidator getValidator(
250     ) {
251         return this;
252     }
253 
254     /**
255      * Method getXMLName.
256      * 
257      * @return the XML Name for the Class being described.
258      */
259     public java.lang.String getXMLName(
260     ) {
261         return _xmlName;
262     }
263 
264     /**
265      * Method isElementDefinition.
266      * 
267      * @return true if XML schema definition of this Class is that
268      * of a global
269      * element or element with anonymous type definition.
270      */
271     public boolean isElementDefinition(
272     ) {
273         return _elementDefinition;
274     }
275 
276 }