View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: DateDescriptor.java,v 1.2 2007/01/04 16:26:24 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.v10.resource;
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 DateDescriptor.
21   * 
22   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
23   */
24  public class DateDescriptor 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 DateDescriptor() {
57          super();
58          nsURI = "http://www.ivoa.net/xml/VOResource/v0.10";
59          xmlName = "Date";
60          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
61          org.exolab.castor.xml.XMLFieldHandler              handler        = null;
62          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
63          //-- _content
64          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.types.Date.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
65          handler = (new org.exolab.castor.xml.XMLFieldHandler() {
66              public java.lang.Object getValue( java.lang.Object object ) 
67                  throws IllegalStateException
68              {
69                  Date target = (Date) object;
70                  return target.getContent();
71              }
72              public void setValue( java.lang.Object object, java.lang.Object value) 
73                  throws IllegalStateException, IllegalArgumentException
74              {
75                  try {
76                      Date target = (Date) object;
77                      target.setContent( (org.exolab.castor.types.Date.parseDate((String) value)));
78                  }
79                  catch (java.lang.Exception ex) {
80                      throw new IllegalStateException(ex.toString());
81                  }
82              }
83              public java.lang.Object newInstance( java.lang.Object parent ) {
84                  return new org.exolab.castor.types.Date();
85              }
86          } );
87          desc.setHandler(handler);
88          addFieldDescriptor(desc);
89          
90          //-- validation code for: _content
91          fieldValidator = new org.exolab.castor.xml.FieldValidator();
92          { //-- local scope
93              DateTimeValidator typeValidator = new DateTimeValidator();
94              fieldValidator.setValidator(typeValidator);
95          }
96          desc.setValidator(fieldValidator);
97          //-- initialize attribute descriptors
98          
99          //-- _role
100         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_role", "role", org.exolab.castor.xml.NodeType.Attribute);
101         desc.setImmutable(true);
102         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
103             public java.lang.Object getValue( java.lang.Object object ) 
104                 throws IllegalStateException
105             {
106                 Date target = (Date) object;
107                 return target.getRole();
108             }
109             public void setValue( java.lang.Object object, java.lang.Object value) 
110                 throws IllegalStateException, IllegalArgumentException
111             {
112                 try {
113                     Date target = (Date) object;
114                     target.setRole( (java.lang.String) value);
115                 }
116                 catch (java.lang.Exception ex) {
117                     throw new IllegalStateException(ex.toString());
118                 }
119             }
120             public java.lang.Object newInstance( java.lang.Object parent ) {
121                 return null;
122             }
123         } );
124         desc.setHandler(handler);
125         addFieldDescriptor(desc);
126         
127         //-- validation code for: _role
128         fieldValidator = new org.exolab.castor.xml.FieldValidator();
129         { //-- local scope
130             StringValidator typeValidator = new StringValidator();
131             typeValidator.setWhiteSpace("preserve");
132             fieldValidator.setValidator(typeValidator);
133         }
134         desc.setValidator(fieldValidator);
135         //-- initialize element descriptors
136         
137     } //-- org.astrogrid.registry.beans.v10.resource.DateDescriptor()
138 
139 
140       //-----------/
141      //- Methods -/
142     //-----------/
143 
144     /***
145      * Method getAccessMode
146      */
147     public org.exolab.castor.mapping.AccessMode getAccessMode()
148     {
149         return null;
150     } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
151 
152     /***
153      * Method getExtends
154      */
155     public org.exolab.castor.mapping.ClassDescriptor getExtends()
156     {
157         return null;
158     } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
159 
160     /***
161      * Method getIdentity
162      */
163     public org.exolab.castor.mapping.FieldDescriptor getIdentity()
164     {
165         return identity;
166     } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
167 
168     /***
169      * Method getJavaClass
170      */
171     public java.lang.Class getJavaClass()
172     {
173         return org.astrogrid.registry.beans.v10.resource.Date.class;
174     } //-- java.lang.Class getJavaClass() 
175 
176     /***
177      * Method getNameSpacePrefix
178      */
179     public java.lang.String getNameSpacePrefix()
180     {
181         return nsPrefix;
182     } //-- java.lang.String getNameSpacePrefix() 
183 
184     /***
185      * Method getNameSpaceURI
186      */
187     public java.lang.String getNameSpaceURI()
188     {
189         return nsURI;
190     } //-- java.lang.String getNameSpaceURI() 
191 
192     /***
193      * Method getValidator
194      */
195     public org.exolab.castor.xml.TypeValidator getValidator()
196     {
197         return this;
198     } //-- org.exolab.castor.xml.TypeValidator getValidator() 
199 
200     /***
201      * Method getXMLName
202      */
203     public java.lang.String getXMLName()
204     {
205         return xmlName;
206     } //-- java.lang.String getXMLName() 
207 
208 }