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.xml.schema.annotations.jdo.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.xml.schema.annotations.jdo.OneToMany;
15  
16  /**
17   * Class OneToManyDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class OneToManyDescriptor extends org.exolab.castor.xml.schema.annotations.jdo.descriptors.ReadonlyDirtyTypeDescriptor {
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 OneToManyDescriptor() {
59          super();
60          setExtendsWithoutFlatten(new org.exolab.castor.xml.schema.annotations.jdo.descriptors.ReadonlyDirtyTypeDescriptor());
61          _nsURI = "http://www.castor.org/binding/persistence";
62          _xmlName = "one-to-many";
63          _elementDefinition = true;
64          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
65          org.exolab.castor.mapping.FieldHandler             handler        = null;
66          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
67          //-- initialize attribute descriptors
68  
69          //-- _name
70          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
71          desc.setImmutable(true);
72          handler = new org.exolab.castor.xml.XMLFieldHandler() {
73              @Override
74              public java.lang.Object getValue( java.lang.Object object ) 
75                  throws IllegalStateException
76              {
77                  OneToMany target = (OneToMany) object;
78                  return target.getName();
79              }
80              @Override
81              public void setValue( java.lang.Object object, java.lang.Object value) 
82                  throws IllegalStateException, IllegalArgumentException
83              {
84                  try {
85                      OneToMany target = (OneToMany) object;
86                      target.setName( (java.lang.String) value);
87                  } catch (java.lang.Exception ex) {
88                      throw new IllegalStateException(ex.toString());
89                  }
90              }
91              @Override
92              @SuppressWarnings("unused")
93              public java.lang.Object newInstance(java.lang.Object parent) {
94                  return null;
95              }
96          };
97          desc.setSchemaType("string");
98          desc.setHandler(handler);
99          desc.setMultivalued(false);
100         addFieldDescriptor(desc);
101 
102         //-- validation code for: _name
103         fieldValidator = new org.exolab.castor.xml.FieldValidator();
104         { //-- local scope
105             org.exolab.castor.xml.validators.StringValidator typeValidator;
106             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
107             fieldValidator.setValidator(typeValidator);
108             typeValidator.setWhiteSpace("preserve");
109         }
110         desc.setValidator(fieldValidator);
111         //-- initialize element descriptors
112 
113     }
114 
115 
116       //-----------/
117      //- Methods -/
118     //-----------/
119 
120     /**
121      * Method getAccessMode.
122      * 
123      * @return the access mode specified for this class.
124      */
125     @Override()
126     public org.exolab.castor.mapping.AccessMode getAccessMode(
127     ) {
128         return null;
129     }
130 
131     /**
132      * Method getIdentity.
133      * 
134      * @return the identity field, null if this class has no
135      * identity.
136      */
137     @Override()
138     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
139     ) {
140         if (_identity == null) {
141             return super.getIdentity();
142         }
143         return _identity;
144     }
145 
146     /**
147      * Method getJavaClass.
148      * 
149      * @return the Java class represented by this descriptor.
150      */
151     @Override()
152     public java.lang.Class getJavaClass(
153     ) {
154         return org.exolab.castor.xml.schema.annotations.jdo.OneToMany.class;
155     }
156 
157     /**
158      * Method getNameSpacePrefix.
159      * 
160      * @return the namespace prefix to use when marshaling as XML.
161      */
162     @Override()
163     public java.lang.String getNameSpacePrefix(
164     ) {
165         return _nsPrefix;
166     }
167 
168     /**
169      * Method getNameSpaceURI.
170      * 
171      * @return the namespace URI used when marshaling and
172      * unmarshaling as XML.
173      */
174     @Override()
175     public java.lang.String getNameSpaceURI(
176     ) {
177         return _nsURI;
178     }
179 
180     /**
181      * Method getValidator.
182      * 
183      * @return a specific validator for the class described by this
184      * ClassDescriptor.
185      */
186     @Override()
187     public org.exolab.castor.xml.TypeValidator getValidator(
188     ) {
189         return this;
190     }
191 
192     /**
193      * Method getXMLName.
194      * 
195      * @return the XML Name for the Class being described.
196      */
197     @Override()
198     public java.lang.String getXMLName(
199     ) {
200         return _xmlName;
201     }
202 
203     /**
204      * Method isElementDefinition.
205      * 
206      * @return true if XML schema definition of this Class is that
207      * of a global
208      * element or element with anonymous type definition.
209      */
210     public boolean isElementDefinition(
211     ) {
212         return _elementDefinition;
213     }
214 
215 }