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: SkySizeDescriptor.java,v 1.2 2007/01/04 16:26:30 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.v10.resource.sia;
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 SkySizeDescriptor.
21   * 
22   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:30 $
23   */
24  public class SkySizeDescriptor 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 SkySizeDescriptor() {
57          super();
58          nsURI = "http://www.ivoa.net/xml/SIA/v0.7";
59          xmlName = "SkySize";
60          
61          //-- set grouping compositor
62          setCompositorAsSequence();
63          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
64          org.exolab.castor.xml.XMLFieldHandler              handler        = null;
65          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
66          //-- initialize attribute descriptors
67          
68          //-- initialize element descriptors
69          
70          //-- _long
71          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_long", "long", org.exolab.castor.xml.NodeType.Element);
72          handler = (new org.exolab.castor.xml.XMLFieldHandler() {
73              public java.lang.Object getValue( java.lang.Object object ) 
74                  throws IllegalStateException
75              {
76                  SkySize target = (SkySize) object;
77                  if(!target.hasLong())
78                      return null;
79                  return new Float(target.getLong());
80              }
81              public void setValue( java.lang.Object object, java.lang.Object value) 
82                  throws IllegalStateException, IllegalArgumentException
83              {
84                  try {
85                      SkySize target = (SkySize) object;
86                      // ignore null values for non optional primitives
87                      if (value == null) return;
88                      
89                      target.setLong( ((Float)value).floatValue());
90                  }
91                  catch (java.lang.Exception ex) {
92                      throw new IllegalStateException(ex.toString());
93                  }
94              }
95              public java.lang.Object newInstance( java.lang.Object parent ) {
96                  return null;
97              }
98          } );
99          desc.setHandler(handler);
100         desc.setNameSpaceURI("http://www.ivoa.net/xml/SIA/v0.7");
101         desc.setRequired(true);
102         desc.setMultivalued(false);
103         addFieldDescriptor(desc);
104         
105         //-- validation code for: _long
106         fieldValidator = new org.exolab.castor.xml.FieldValidator();
107         fieldValidator.setMinOccurs(1);
108         { //-- local scope
109             FloatValidator typeValidator = new FloatValidator();
110             fieldValidator.setValidator(typeValidator);
111         }
112         desc.setValidator(fieldValidator);
113         //-- _lat
114         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_lat", "lat", org.exolab.castor.xml.NodeType.Element);
115         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
116             public java.lang.Object getValue( java.lang.Object object ) 
117                 throws IllegalStateException
118             {
119                 SkySize target = (SkySize) object;
120                 if(!target.hasLat())
121                     return null;
122                 return new Float(target.getLat());
123             }
124             public void setValue( java.lang.Object object, java.lang.Object value) 
125                 throws IllegalStateException, IllegalArgumentException
126             {
127                 try {
128                     SkySize target = (SkySize) object;
129                     // ignore null values for non optional primitives
130                     if (value == null) return;
131                     
132                     target.setLat( ((Float)value).floatValue());
133                 }
134                 catch (java.lang.Exception ex) {
135                     throw new IllegalStateException(ex.toString());
136                 }
137             }
138             public java.lang.Object newInstance( java.lang.Object parent ) {
139                 return null;
140             }
141         } );
142         desc.setHandler(handler);
143         desc.setNameSpaceURI("http://www.ivoa.net/xml/SIA/v0.7");
144         desc.setRequired(true);
145         desc.setMultivalued(false);
146         addFieldDescriptor(desc);
147         
148         //-- validation code for: _lat
149         fieldValidator = new org.exolab.castor.xml.FieldValidator();
150         fieldValidator.setMinOccurs(1);
151         { //-- local scope
152             FloatValidator typeValidator = new FloatValidator();
153             fieldValidator.setValidator(typeValidator);
154         }
155         desc.setValidator(fieldValidator);
156     } //-- org.astrogrid.registry.beans.v10.resource.sia.SkySizeDescriptor()
157 
158 
159       //-----------/
160      //- Methods -/
161     //-----------/
162 
163     /***
164      * Method getAccessMode
165      */
166     public org.exolab.castor.mapping.AccessMode getAccessMode()
167     {
168         return null;
169     } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
170 
171     /***
172      * Method getExtends
173      */
174     public org.exolab.castor.mapping.ClassDescriptor getExtends()
175     {
176         return null;
177     } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
178 
179     /***
180      * Method getIdentity
181      */
182     public org.exolab.castor.mapping.FieldDescriptor getIdentity()
183     {
184         return identity;
185     } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
186 
187     /***
188      * Method getJavaClass
189      */
190     public java.lang.Class getJavaClass()
191     {
192         return org.astrogrid.registry.beans.v10.resource.sia.SkySize.class;
193     } //-- java.lang.Class getJavaClass() 
194 
195     /***
196      * Method getNameSpacePrefix
197      */
198     public java.lang.String getNameSpacePrefix()
199     {
200         return nsPrefix;
201     } //-- java.lang.String getNameSpacePrefix() 
202 
203     /***
204      * Method getNameSpaceURI
205      */
206     public java.lang.String getNameSpaceURI()
207     {
208         return nsURI;
209     } //-- java.lang.String getNameSpaceURI() 
210 
211     /***
212      * Method getValidator
213      */
214     public org.exolab.castor.xml.TypeValidator getValidator()
215     {
216         return this;
217     } //-- org.exolab.castor.xml.TypeValidator getValidator() 
218 
219     /***
220      * Method getXMLName
221      */
222     public java.lang.String getXMLName()
223     {
224         return xmlName;
225     } //-- java.lang.String getXMLName() 
226 
227 }