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.CacheTypeMapping;
15  
16  /**
17   * Class CacheTypeMappingDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class CacheTypeMappingDescriptor 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 CacheTypeMappingDescriptor() {
59          super();
60          _nsURI = "http://castor.exolab.org/";
61          _xmlName = "cache-type";
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          //-- _type
72          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);
73          desc.setImmutable(true);
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                  CacheTypeMapping target = (CacheTypeMapping) object;
80                  return target.getType();
81              }
82              @Override
83              public void setValue( java.lang.Object object, java.lang.Object value) 
84                  throws IllegalStateException, IllegalArgumentException
85              {
86                  try {
87                      CacheTypeMapping target = (CacheTypeMapping) object;
88                      target.setType( (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 null;
97              }
98          };
99          desc.setSchemaType("string");
100         desc.setHandler(handler);
101         desc.setMultivalued(false);
102         addFieldDescriptor(desc);
103 
104         //-- validation code for: _type
105         fieldValidator = new org.exolab.castor.xml.FieldValidator();
106         { //-- local scope
107             org.exolab.castor.xml.validators.StringValidator typeValidator;
108             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
109             fieldValidator.setValidator(typeValidator);
110             typeValidator.setWhiteSpace("preserve");
111         }
112         desc.setValidator(fieldValidator);
113         //-- _debug
114         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_debug", "debug", org.exolab.castor.xml.NodeType.Attribute);
115         handler = new org.exolab.castor.xml.XMLFieldHandler() {
116             @Override
117             public java.lang.Object getValue( java.lang.Object object ) 
118                 throws IllegalStateException
119             {
120                 CacheTypeMapping target = (CacheTypeMapping) object;
121                 if (!target.hasDebug()) { return null; }
122                 return (target.getDebug() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
123             }
124             @Override
125             public void setValue( java.lang.Object object, java.lang.Object value) 
126                 throws IllegalStateException, IllegalArgumentException
127             {
128                 try {
129                     CacheTypeMapping target = (CacheTypeMapping) object;
130                     // if null, use delete method for optional primitives 
131                     if (value == null) {
132                         target.deleteDebug();
133                         return;
134                     }
135                     target.setDebug( ((java.lang.Boolean) value).booleanValue());
136                 } catch (java.lang.Exception ex) {
137                     throw new IllegalStateException(ex.toString());
138                 }
139             }
140             @Override
141             @SuppressWarnings("unused")
142             public java.lang.Object newInstance(java.lang.Object parent) {
143                 return null;
144             }
145         };
146         desc.setSchemaType("boolean");
147         desc.setHandler(handler);
148         desc.setMultivalued(false);
149         addFieldDescriptor(desc);
150 
151         //-- validation code for: _debug
152         fieldValidator = new org.exolab.castor.xml.FieldValidator();
153         { //-- local scope
154             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
155             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
156             fieldValidator.setValidator(typeValidator);
157         }
158         desc.setValidator(fieldValidator);
159         //-- _capacity
160         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_capacity", "capacity", org.exolab.castor.xml.NodeType.Attribute);
161         handler = new org.exolab.castor.xml.XMLFieldHandler() {
162             @Override
163             public java.lang.Object getValue( java.lang.Object object ) 
164                 throws IllegalStateException
165             {
166                 CacheTypeMapping target = (CacheTypeMapping) object;
167                 if (!target.hasCapacity()) { return null; }
168                 return new java.lang.Long(target.getCapacity());
169             }
170             @Override
171             public void setValue( java.lang.Object object, java.lang.Object value) 
172                 throws IllegalStateException, IllegalArgumentException
173             {
174                 try {
175                     CacheTypeMapping target = (CacheTypeMapping) object;
176                     // if null, use delete method for optional primitives 
177                     if (value == null) {
178                         target.deleteCapacity();
179                         return;
180                     }
181                     target.setCapacity( ((java.lang.Long) value).longValue());
182                 } catch (java.lang.Exception ex) {
183                     throw new IllegalStateException(ex.toString());
184                 }
185             }
186             @Override
187             @SuppressWarnings("unused")
188             public java.lang.Object newInstance(java.lang.Object parent) {
189                 return null;
190             }
191         };
192         desc.setSchemaType("integer");
193         desc.setHandler(handler);
194         desc.setMultivalued(false);
195         addFieldDescriptor(desc);
196 
197         //-- validation code for: _capacity
198         fieldValidator = new org.exolab.castor.xml.FieldValidator();
199         { //-- local scope
200             org.exolab.castor.xml.validators.LongValidator typeValidator;
201             typeValidator = new org.exolab.castor.xml.validators.LongValidator();
202             fieldValidator.setValidator(typeValidator);
203         }
204         desc.setValidator(fieldValidator);
205         //-- initialize element descriptors
206 
207         //-- _paramList
208         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.Param.class, "_paramList", "param", org.exolab.castor.xml.NodeType.Element);
209         handler = new org.exolab.castor.xml.XMLFieldHandler() {
210             @Override
211             public java.lang.Object getValue( java.lang.Object object ) 
212                 throws IllegalStateException
213             {
214                 CacheTypeMapping target = (CacheTypeMapping) object;
215                 return target.getParam();
216             }
217             @Override
218             public void setValue( java.lang.Object object, java.lang.Object value) 
219                 throws IllegalStateException, IllegalArgumentException
220             {
221                 try {
222                     CacheTypeMapping target = (CacheTypeMapping) object;
223                     target.addParam( (org.exolab.castor.mapping.xml.Param) value);
224                 } catch (java.lang.Exception ex) {
225                     throw new IllegalStateException(ex.toString());
226                 }
227             }
228             public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
229                 try {
230                     CacheTypeMapping target = (CacheTypeMapping) object;
231                     target.removeAllParam();
232                 } catch (java.lang.Exception ex) {
233                     throw new IllegalStateException(ex.toString());
234                 }
235             }
236             @Override
237             @SuppressWarnings("unused")
238             public java.lang.Object newInstance(java.lang.Object parent) {
239                 return null;
240             }
241         };
242         desc.setSchemaType("list");
243         desc.setComponentType("org.exolab.castor.mapping.xml.Param");
244         desc.setHandler(handler);
245         desc.setNameSpaceURI("http://castor.exolab.org/");
246         desc.setMultivalued(true);
247         addFieldDescriptor(desc);
248         addSequenceElement(desc);
249 
250         //-- validation code for: _paramList
251         fieldValidator = new org.exolab.castor.xml.FieldValidator();
252         fieldValidator.setMinOccurs(0);
253         { //-- local scope
254         }
255         desc.setValidator(fieldValidator);
256     }
257 
258 
259       //-----------/
260      //- Methods -/
261     //-----------/
262 
263     /**
264      * Method getAccessMode.
265      * 
266      * @return the access mode specified for this class.
267      */
268     @Override()
269     public org.exolab.castor.mapping.AccessMode getAccessMode(
270     ) {
271         return null;
272     }
273 
274     /**
275      * Method getIdentity.
276      * 
277      * @return the identity field, null if this class has no
278      * identity.
279      */
280     @Override()
281     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
282     ) {
283         return _identity;
284     }
285 
286     /**
287      * Method getJavaClass.
288      * 
289      * @return the Java class represented by this descriptor.
290      */
291     @Override()
292     public java.lang.Class getJavaClass(
293     ) {
294         return org.exolab.castor.mapping.xml.CacheTypeMapping.class;
295     }
296 
297     /**
298      * Method getNameSpacePrefix.
299      * 
300      * @return the namespace prefix to use when marshaling as XML.
301      */
302     @Override()
303     public java.lang.String getNameSpacePrefix(
304     ) {
305         return _nsPrefix;
306     }
307 
308     /**
309      * Method getNameSpaceURI.
310      * 
311      * @return the namespace URI used when marshaling and
312      * unmarshaling as XML.
313      */
314     @Override()
315     public java.lang.String getNameSpaceURI(
316     ) {
317         return _nsURI;
318     }
319 
320     /**
321      * Method getValidator.
322      * 
323      * @return a specific validator for the class described by this
324      * ClassDescriptor.
325      */
326     @Override()
327     public org.exolab.castor.xml.TypeValidator getValidator(
328     ) {
329         return this;
330     }
331 
332     /**
333      * Method getXMLName.
334      * 
335      * @return the XML Name for the Class being described.
336      */
337     @Override()
338     public java.lang.String getXMLName(
339     ) {
340         return _xmlName;
341     }
342 
343     /**
344      * Method isElementDefinition.
345      * 
346      * @return true if XML schema definition of this Class is that
347      * of a global
348      * element or element with anonymous type definition.
349      */
350     public boolean isElementDefinition(
351     ) {
352         return _elementDefinition;
353     }
354 
355 }