View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package fr.in2p3.jsaga.adaptor.schema.job.emulator.config;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.mapping.AccessMode;
15  import org.exolab.castor.xml.TypeValidator;
16  import org.exolab.castor.xml.XMLFieldDescriptor;
17  import org.exolab.castor.xml.validators.*;
18  
19  /**
20   * Class DelayTypeDescriptor.
21   * 
22   * @version $Revision$ $Date$
23   */
24  public class DelayTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
25  
26  
27        //--------------------------/
28       //- Class/Member Variables -/
29      //--------------------------/
30  
31      /**
32       * Field nsPrefix
33       */
34      private java.lang.String nsPrefix;
35  
36      /**
37       * Field nsURI
38       */
39      private java.lang.String nsURI;
40  
41      /**
42       * Field xmlName
43       */
44      private java.lang.String xmlName;
45  
46      /**
47       * Field identity
48       */
49      private org.exolab.castor.xml.XMLFieldDescriptor identity;
50  
51  
52        //----------------/
53       //- Constructors -/
54      //----------------/
55  
56      public DelayTypeDescriptor() 
57       {
58          super();
59          nsURI = "http://www.in2p3.fr/jsaga/job-emulator-config";
60          xmlName = "DelayType";
61          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
62          org.exolab.castor.mapping.FieldHandler             handler        = null;
63          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
64          //-- initialize attribute descriptors
65          
66          //-- _time
67          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.types.Duration.class, "_time", "time", org.exolab.castor.xml.NodeType.Attribute);
68          handler = new org.exolab.castor.xml.XMLFieldHandler() {
69              public java.lang.Object getValue( java.lang.Object object ) 
70                  throws IllegalStateException
71              {
72                  DelayType target = (DelayType) object;
73                  return target.getTime();
74              }
75              public void setValue( java.lang.Object object, java.lang.Object value) 
76                  throws IllegalStateException, IllegalArgumentException
77              {
78                  try {
79                      DelayType target = (DelayType) object;
80                      target.setTime( (org.exolab.castor.types.Duration.parseDuration((String) value)));
81                  }
82                  catch (java.lang.Exception ex) {
83                      throw new IllegalStateException(ex.toString());
84                  }
85              }
86              public java.lang.Object newInstance( java.lang.Object parent ) {
87                  return new org.exolab.castor.types.Duration();
88              }
89          };
90          desc.setHandler(handler);
91          desc.setNameSpaceURI("http://www.in2p3.fr/jsaga/job-emulator-config");
92          desc.setRequired(true);
93          desc.setMultivalued(false);
94          addFieldDescriptor(desc);
95          
96          //-- validation code for: _time
97          fieldValidator = new org.exolab.castor.xml.FieldValidator();
98          fieldValidator.setMinOccurs(1);
99          { //-- local scope
100             DurationValidator typeValidator = new DurationValidator();
101             fieldValidator.setValidator(typeValidator);
102         }
103         desc.setValidator(fieldValidator);
104         //-- _percent
105         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_percent", "percent", org.exolab.castor.xml.NodeType.Attribute);
106         handler = new org.exolab.castor.xml.XMLFieldHandler() {
107             public java.lang.Object getValue( java.lang.Object object ) 
108                 throws IllegalStateException
109             {
110                 DelayType target = (DelayType) object;
111                 if(!target.hasPercent())
112                     return null;
113                 return new java.lang.Float(target.getPercent());
114             }
115             public void setValue( java.lang.Object object, java.lang.Object value) 
116                 throws IllegalStateException, IllegalArgumentException
117             {
118                 try {
119                     DelayType target = (DelayType) object;
120                     // ignore null values for non optional primitives
121                     if (value == null) return;
122                     
123                     target.setPercent( ((java.lang.Float)value).floatValue());
124                 }
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.setHandler(handler);
134         desc.setNameSpaceURI("http://www.in2p3.fr/jsaga/job-emulator-config");
135         desc.setRequired(true);
136         desc.setMultivalued(false);
137         addFieldDescriptor(desc);
138         
139         //-- validation code for: _percent
140         fieldValidator = new org.exolab.castor.xml.FieldValidator();
141         fieldValidator.setMinOccurs(1);
142         { //-- local scope
143             FloatValidator typeValidator = new FloatValidator();
144             typeValidator.setMinInclusive(0.0f);
145             typeValidator.setMaxInclusive(1.0f);
146             fieldValidator.setValidator(typeValidator);
147         }
148         desc.setValidator(fieldValidator);
149         //-- initialize element descriptors
150         
151     } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.config.DelayTypeDescriptor()
152 
153 
154       //-----------/
155      //- Methods -/
156     //-----------/
157 
158     /**
159      * Method getAccessMode
160      * 
161      * 
162      * 
163      * @return AccessMode
164      */
165     public org.exolab.castor.mapping.AccessMode getAccessMode()
166     {
167         return null;
168     } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
169 
170     /**
171      * Method getExtends
172      * 
173      * 
174      * 
175      * @return ClassDescriptor
176      */
177     public org.exolab.castor.mapping.ClassDescriptor getExtends()
178     {
179         return null;
180     } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
181 
182     /**
183      * Method getIdentity
184      * 
185      * 
186      * 
187      * @return FieldDescriptor
188      */
189     public org.exolab.castor.mapping.FieldDescriptor getIdentity()
190     {
191         return identity;
192     } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
193 
194     /**
195      * Method getJavaClass
196      * 
197      * 
198      * 
199      * @return Class
200      */
201     public java.lang.Class getJavaClass()
202     {
203         return fr.in2p3.jsaga.adaptor.schema.job.emulator.config.DelayType.class;
204     } //-- java.lang.Class getJavaClass() 
205 
206     /**
207      * Method getNameSpacePrefix
208      * 
209      * 
210      * 
211      * @return String
212      */
213     public java.lang.String getNameSpacePrefix()
214     {
215         return nsPrefix;
216     } //-- java.lang.String getNameSpacePrefix() 
217 
218     /**
219      * Method getNameSpaceURI
220      * 
221      * 
222      * 
223      * @return String
224      */
225     public java.lang.String getNameSpaceURI()
226     {
227         return nsURI;
228     } //-- java.lang.String getNameSpaceURI() 
229 
230     /**
231      * Method getValidator
232      * 
233      * 
234      * 
235      * @return TypeValidator
236      */
237     public org.exolab.castor.xml.TypeValidator getValidator()
238     {
239         return this;
240     } //-- org.exolab.castor.xml.TypeValidator getValidator() 
241 
242     /**
243      * Method getXMLName
244      * 
245      * 
246      * 
247      * @return String
248      */
249     public java.lang.String getXMLName()
250     {
251         return xmlName;
252     } //-- java.lang.String getXMLName() 
253 
254 }