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.builder.binding.xml;
9   
10  /**
11   * This type represents the binding for class member. It allows the
12   * definition
13   *  of its name and java type as well as an implementation of
14   * FieldHandler 
15   *  to help the Marshalling framework in handling that member.
16   * Defining a validator is also
17   *  possible. The names given for the validator and the
18   * fieldHandler must be fully qualified
19   *  
20   * 
21   * @version $Revision$ $Date$
22   */
23  public class FieldType implements java.io.Serializable {
24  
25  
26        //--------------------------/
27       //- Class/Member Variables -/
28      //--------------------------/
29  
30      /**
31       * Field _name.
32       */
33      private java.lang.String _name;
34  
35      /**
36       * Field _javaType.
37       */
38      private java.lang.String _javaType;
39  
40      /**
41       * Field _wrapper.
42       */
43      private boolean _wrapper;
44  
45      /**
46       * keeps track of state for field: _wrapper
47       */
48      private boolean _has_wrapper;
49  
50      /**
51       * Field _handler.
52       */
53      private java.lang.String _handler;
54  
55      /**
56       * Field _collection.
57       */
58      private org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType _collection;
59  
60      /**
61       * Field _visibility.
62       */
63      private org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType _visibility;
64  
65      /**
66       * Field _validator.
67       */
68      private java.lang.String _validator;
69  
70  
71        //----------------/
72       //- Constructors -/
73      //----------------/
74  
75      public FieldType() {
76          super();
77      }
78  
79  
80        //-----------/
81       //- Methods -/
82      //-----------/
83  
84      /**
85       */
86      public void deleteWrapper(
87      ) {
88          this._has_wrapper= false;
89      }
90  
91      /**
92       * Returns the value of field 'collection'.
93       * 
94       * @return the value of field 'Collection'.
95       */
96      public org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType getCollection(
97      ) {
98          return this._collection;
99      }
100 
101     /**
102      * Returns the value of field 'handler'.
103      * 
104      * @return the value of field 'Handler'.
105      */
106     public java.lang.String getHandler(
107     ) {
108         return this._handler;
109     }
110 
111     /**
112      * Returns the value of field 'javaType'.
113      * 
114      * @return the value of field 'JavaType'.
115      */
116     public java.lang.String getJavaType(
117     ) {
118         return this._javaType;
119     }
120 
121     /**
122      * Returns the value of field 'name'.
123      * 
124      * @return the value of field 'Name'.
125      */
126     public java.lang.String getName(
127     ) {
128         return this._name;
129     }
130 
131     /**
132      * Returns the value of field 'validator'.
133      * 
134      * @return the value of field 'Validator'.
135      */
136     public java.lang.String getValidator(
137     ) {
138         return this._validator;
139     }
140 
141     /**
142      * Returns the value of field 'visibility'.
143      * 
144      * @return the value of field 'Visibility'.
145      */
146     public org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType getVisibility(
147     ) {
148         return this._visibility;
149     }
150 
151     /**
152      * Returns the value of field 'wrapper'.
153      * 
154      * @return the value of field 'Wrapper'.
155      */
156     public boolean getWrapper(
157     ) {
158         return this._wrapper;
159     }
160 
161     /**
162      * Method hasWrapper.
163      * 
164      * @return true if at least one Wrapper has been added
165      */
166     public boolean hasWrapper(
167     ) {
168         return this._has_wrapper;
169     }
170 
171     /**
172      * Method isValid.
173      * 
174      * @return true if this object is valid according to the schema
175      */
176     public boolean isValid(
177     ) {
178         try {
179             validate();
180         } catch (org.exolab.castor.xml.ValidationException vex) {
181             return false;
182         }
183         return true;
184     }
185 
186     /**
187      * Returns the value of field 'wrapper'.
188      * 
189      * @return the value of field 'Wrapper'.
190      */
191     public boolean isWrapper(
192     ) {
193         return this._wrapper;
194     }
195 
196     /**
197      * 
198      * 
199      * @param out
200      * @throws org.exolab.castor.xml.MarshalException if object is
201      * null or if any SAXException is thrown during marshaling
202      * @throws org.exolab.castor.xml.ValidationException if this
203      * object is an invalid instance according to the schema
204      */
205     public void marshal(
206             final java.io.Writer out)
207     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
208         org.exolab.castor.xml.Marshaller.marshal(this, out);
209     }
210 
211     /**
212      * 
213      * 
214      * @param handler
215      * @throws java.io.IOException if an IOException occurs during
216      * marshaling
217      * @throws org.exolab.castor.xml.ValidationException if this
218      * object is an invalid instance according to the schema
219      * @throws org.exolab.castor.xml.MarshalException if object is
220      * null or if any SAXException is thrown during marshaling
221      */
222     public void marshal(
223             final org.xml.sax.ContentHandler handler)
224     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
225         org.exolab.castor.xml.Marshaller.marshal(this, handler);
226     }
227 
228     /**
229      * Sets the value of field 'collection'.
230      * 
231      * @param collection the value of field 'collection'.
232      */
233     public void setCollection(
234             final org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType collection) {
235         this._collection = collection;
236     }
237 
238     /**
239      * Sets the value of field 'handler'.
240      * 
241      * @param handler the value of field 'handler'.
242      */
243     public void setHandler(
244             final java.lang.String handler) {
245         this._handler = handler;
246     }
247 
248     /**
249      * Sets the value of field 'javaType'.
250      * 
251      * @param javaType the value of field 'javaType'.
252      */
253     public void setJavaType(
254             final java.lang.String javaType) {
255         this._javaType = javaType;
256     }
257 
258     /**
259      * Sets the value of field 'name'.
260      * 
261      * @param name the value of field 'name'.
262      */
263     public void setName(
264             final java.lang.String name) {
265         this._name = name;
266     }
267 
268     /**
269      * Sets the value of field 'validator'.
270      * 
271      * @param validator the value of field 'validator'.
272      */
273     public void setValidator(
274             final java.lang.String validator) {
275         this._validator = validator;
276     }
277 
278     /**
279      * Sets the value of field 'visibility'.
280      * 
281      * @param visibility the value of field 'visibility'.
282      */
283     public void setVisibility(
284             final org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType visibility) {
285         this._visibility = visibility;
286     }
287 
288     /**
289      * Sets the value of field 'wrapper'.
290      * 
291      * @param wrapper the value of field 'wrapper'.
292      */
293     public void setWrapper(
294             final boolean wrapper) {
295         this._wrapper = wrapper;
296         this._has_wrapper = true;
297     }
298 
299     /**
300      * Method unmarshalFieldType.
301      * 
302      * @param reader
303      * @throws org.exolab.castor.xml.MarshalException if object is
304      * null or if any SAXException is thrown during marshaling
305      * @throws org.exolab.castor.xml.ValidationException if this
306      * object is an invalid instance according to the schema
307      * @return the unmarshaled
308      * org.exolab.castor.builder.binding.xml.FieldType
309      */
310     public static org.exolab.castor.builder.binding.xml.FieldType unmarshalFieldType(
311             final java.io.Reader reader)
312     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
313         return (org.exolab.castor.builder.binding.xml.FieldType) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.builder.binding.xml.FieldType.class, reader);
314     }
315 
316     /**
317      * 
318      * 
319      * @throws org.exolab.castor.xml.ValidationException if this
320      * object is an invalid instance according to the schema
321      */
322     public void validate(
323     )
324     throws org.exolab.castor.xml.ValidationException {
325         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
326         validator.validate(this);
327     }
328 
329 }