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.FieldHandlerDef;
15  
16  /**
17   * Class FieldHandlerDefDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class FieldHandlerDefDescriptor 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 FieldHandlerDefDescriptor() {
59          super();
60          _nsURI = "http://castor.exolab.org/";
61          _xmlName = "field-handler";
62          _elementDefinition = true;
63  
64          //-- set grouping compositor
65          setCompositorAsSequence();
66          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
67          org.exolab.castor.mapping.FieldHandler             handler        = null;
68          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
69          //-- initialize attribute descriptors
70  
71          //-- _name
72          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
73          this._identity = desc;
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                  FieldHandlerDef target = (FieldHandlerDef) object;
80                  return target.getName();
81              }
82              @Override
83              public void setValue( java.lang.Object object, java.lang.Object value) 
84                  throws IllegalStateException, IllegalArgumentException
85              {
86                  try {
87                      FieldHandlerDef target = (FieldHandlerDef) object;
88                      target.setName( (java.lang.String) value);
89                  } catch (java.lang.Exception ex) {
90                      throw new IllegalStateException(ex.toString());
91                  }
92              }
93              @Override
94              @SuppressWarnings("unused")
95              public java.lang.Object newInstance(java.lang.Object parent) {
96                  return new java.lang.String();
97              }
98          };
99          desc.setSchemaType("ID");
100         desc.setHandler(handler);
101         desc.setRequired(true);
102         desc.setMultivalued(false);
103         addFieldDescriptor(desc);
104 
105         //-- validation code for: _name
106         fieldValidator = new org.exolab.castor.xml.FieldValidator();
107         fieldValidator.setMinOccurs(1);
108         { //-- local scope
109             org.exolab.castor.xml.validators.IdValidator typeValidator;
110             typeValidator = new org.exolab.castor.xml.validators.IdValidator();
111             fieldValidator.setValidator(typeValidator);
112         }
113         desc.setValidator(fieldValidator);
114         //-- _clazz
115         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_clazz", "class", org.exolab.castor.xml.NodeType.Attribute);
116         desc.setImmutable(true);
117         handler = new org.exolab.castor.xml.XMLFieldHandler() {
118             @Override
119             public java.lang.Object getValue( java.lang.Object object ) 
120                 throws IllegalStateException
121             {
122                 FieldHandlerDef target = (FieldHandlerDef) object;
123                 return target.getClazz();
124             }
125             @Override
126             public void setValue( java.lang.Object object, java.lang.Object value) 
127                 throws IllegalStateException, IllegalArgumentException
128             {
129                 try {
130                     FieldHandlerDef target = (FieldHandlerDef) object;
131                     target.setClazz( (java.lang.String) value);
132                 } catch (java.lang.Exception ex) {
133                     throw new IllegalStateException(ex.toString());
134                 }
135             }
136             @Override
137             @SuppressWarnings("unused")
138             public java.lang.Object newInstance(java.lang.Object parent) {
139                 return null;
140             }
141         };
142         desc.setSchemaType("string");
143         desc.setHandler(handler);
144         desc.setRequired(true);
145         desc.setMultivalued(false);
146         addFieldDescriptor(desc);
147 
148         //-- validation code for: _clazz
149         fieldValidator = new org.exolab.castor.xml.FieldValidator();
150         fieldValidator.setMinOccurs(1);
151         { //-- local scope
152             org.exolab.castor.xml.validators.StringValidator typeValidator;
153             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
154             fieldValidator.setValidator(typeValidator);
155             typeValidator.setWhiteSpace("preserve");
156         }
157         desc.setValidator(fieldValidator);
158         //-- initialize element descriptors
159 
160         //-- _paramList
161         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.Param.class, "_paramList", "param", org.exolab.castor.xml.NodeType.Element);
162         handler = new org.exolab.castor.xml.XMLFieldHandler() {
163             @Override
164             public java.lang.Object getValue( java.lang.Object object ) 
165                 throws IllegalStateException
166             {
167                 FieldHandlerDef target = (FieldHandlerDef) object;
168                 return target.getParam();
169             }
170             @Override
171             public void setValue( java.lang.Object object, java.lang.Object value) 
172                 throws IllegalStateException, IllegalArgumentException
173             {
174                 try {
175                     FieldHandlerDef target = (FieldHandlerDef) object;
176                     target.addParam( (org.exolab.castor.mapping.xml.Param) value);
177                 } catch (java.lang.Exception ex) {
178                     throw new IllegalStateException(ex.toString());
179                 }
180             }
181             public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
182                 try {
183                     FieldHandlerDef target = (FieldHandlerDef) object;
184                     target.removeAllParam();
185                 } catch (java.lang.Exception ex) {
186                     throw new IllegalStateException(ex.toString());
187                 }
188             }
189             @Override
190             @SuppressWarnings("unused")
191             public java.lang.Object newInstance(java.lang.Object parent) {
192                 return null;
193             }
194         };
195         desc.setSchemaType("list");
196         desc.setComponentType("org.exolab.castor.mapping.xml.Param");
197         desc.setHandler(handler);
198         desc.setNameSpaceURI("http://castor.exolab.org/");
199         desc.setMultivalued(true);
200         addFieldDescriptor(desc);
201         addSequenceElement(desc);
202 
203         //-- validation code for: _paramList
204         fieldValidator = new org.exolab.castor.xml.FieldValidator();
205         fieldValidator.setMinOccurs(0);
206         { //-- local scope
207         }
208         desc.setValidator(fieldValidator);
209     }
210 
211 
212       //-----------/
213      //- Methods -/
214     //-----------/
215 
216     /**
217      * Method getAccessMode.
218      * 
219      * @return the access mode specified for this class.
220      */
221     @Override()
222     public org.exolab.castor.mapping.AccessMode getAccessMode(
223     ) {
224         return null;
225     }
226 
227     /**
228      * Method getIdentity.
229      * 
230      * @return the identity field, null if this class has no
231      * identity.
232      */
233     @Override()
234     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
235     ) {
236         return _identity;
237     }
238 
239     /**
240      * Method getJavaClass.
241      * 
242      * @return the Java class represented by this descriptor.
243      */
244     @Override()
245     public java.lang.Class getJavaClass(
246     ) {
247         return org.exolab.castor.mapping.xml.FieldHandlerDef.class;
248     }
249 
250     /**
251      * Method getNameSpacePrefix.
252      * 
253      * @return the namespace prefix to use when marshaling as XML.
254      */
255     @Override()
256     public java.lang.String getNameSpacePrefix(
257     ) {
258         return _nsPrefix;
259     }
260 
261     /**
262      * Method getNameSpaceURI.
263      * 
264      * @return the namespace URI used when marshaling and
265      * unmarshaling as XML.
266      */
267     @Override()
268     public java.lang.String getNameSpaceURI(
269     ) {
270         return _nsURI;
271     }
272 
273     /**
274      * Method getValidator.
275      * 
276      * @return a specific validator for the class described by this
277      * ClassDescriptor.
278      */
279     @Override()
280     public org.exolab.castor.xml.TypeValidator getValidator(
281     ) {
282         return this;
283     }
284 
285     /**
286      * Method getXMLName.
287      * 
288      * @return the XML Name for the Class being described.
289      */
290     @Override()
291     public java.lang.String getXMLName(
292     ) {
293         return _xmlName;
294     }
295 
296     /**
297      * Method isElementDefinition.
298      * 
299      * @return true if XML schema definition of this Class is that
300      * of a global
301      * element or element with anonymous type definition.
302      */
303     public boolean isElementDefinition(
304     ) {
305         return _elementDefinition;
306     }
307 
308 }