001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 1.1-M2</a>, using an XML
004: * Schema.
005: * $Id: FieldType.java 6766 2007-01-18 21:12:08Z wguttmn $
006: */
007:
008: package org.exolab.castor.builder.binding.xml;
009:
010: //---------------------------------/
011: //- Imported classes and packages -/
012: //---------------------------------/
013:
014: import org.exolab.castor.xml.Marshaller;
015: import org.exolab.castor.xml.Unmarshaller;
016:
017: /**
018: * This type represents the binding for class member. It allows the
019: * definition
020: * of its name and java type as well as an implementation of
021: * FieldHandler
022: * to help the Marshalling framework in handling that member.
023: * Defining a validator is also
024: * possible. The names given for the validator and the
025: * fieldHandler must be fully qualified
026: *
027: *
028: * @version $Revision: 6766 $ $Date$
029: */
030: public class FieldType implements java.io.Serializable {
031:
032: //--------------------------/
033: //- Class/Member Variables -/
034: //--------------------------/
035:
036: /**
037: * Field _name.
038: */
039: private java.lang.String _name;
040:
041: /**
042: * Field _javaType.
043: */
044: private java.lang.String _javaType;
045:
046: /**
047: * Field _wrapper.
048: */
049: private boolean _wrapper;
050:
051: /**
052: * keeps track of state for field: _wrapper
053: */
054: private boolean _has_wrapper;
055:
056: /**
057: * Field _handler.
058: */
059: private java.lang.String _handler;
060:
061: /**
062: * Field _collection.
063: */
064: private org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType _collection;
065:
066: /**
067: * Field _visibility.
068: */
069: private org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType _visibility;
070:
071: /**
072: * Field _validator.
073: */
074: private java.lang.String _validator;
075:
076: //----------------/
077: //- Constructors -/
078: //----------------/
079:
080: public FieldType() {
081: super ();
082: }
083:
084: //-----------/
085: //- Methods -/
086: //-----------/
087:
088: /**
089: */
090: public void deleteWrapper() {
091: this ._has_wrapper = false;
092: }
093:
094: /**
095: * Returns the value of field 'collection'.
096: *
097: * @return the value of field 'Collection'.
098: */
099: public org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType getCollection() {
100: return this ._collection;
101: }
102:
103: /**
104: * Returns the value of field 'handler'.
105: *
106: * @return the value of field 'Handler'.
107: */
108: public java.lang.String getHandler() {
109: return this ._handler;
110: }
111:
112: /**
113: * Returns the value of field 'javaType'.
114: *
115: * @return the value of field 'JavaType'.
116: */
117: public java.lang.String getJavaType() {
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: return this ._name;
128: }
129:
130: /**
131: * Returns the value of field 'validator'.
132: *
133: * @return the value of field 'Validator'.
134: */
135: public java.lang.String getValidator() {
136: return this ._validator;
137: }
138:
139: /**
140: * Returns the value of field 'visibility'.
141: *
142: * @return the value of field 'Visibility'.
143: */
144: public org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType getVisibility() {
145: return this ._visibility;
146: }
147:
148: /**
149: * Returns the value of field 'wrapper'.
150: *
151: * @return the value of field 'Wrapper'.
152: */
153: public boolean getWrapper() {
154: return this ._wrapper;
155: }
156:
157: /**
158: * Method hasWrapper.
159: *
160: * @return true if at least one Wrapper has been added
161: */
162: public boolean hasWrapper() {
163: return this ._has_wrapper;
164: }
165:
166: /**
167: * Method isValid.
168: *
169: * @return true if this object is valid according to the schema
170: */
171: public boolean isValid() {
172: try {
173: validate();
174: } catch (org.exolab.castor.xml.ValidationException vex) {
175: return false;
176: }
177: return true;
178: }
179:
180: /**
181: * Returns the value of field 'wrapper'.
182: *
183: * @return the value of field 'Wrapper'.
184: */
185: public boolean isWrapper() {
186: return this ._wrapper;
187: }
188:
189: /**
190: *
191: *
192: * @param out
193: * @throws org.exolab.castor.xml.MarshalException if object is
194: * null or if any SAXException is thrown during marshaling
195: * @throws org.exolab.castor.xml.ValidationException if this
196: * object is an invalid instance according to the schema
197: */
198: public void marshal(final java.io.Writer out)
199: throws org.exolab.castor.xml.MarshalException,
200: org.exolab.castor.xml.ValidationException {
201: Marshaller.marshal(this , out);
202: }
203:
204: /**
205: *
206: *
207: * @param handler
208: * @throws java.io.IOException if an IOException occurs during
209: * marshaling
210: * @throws org.exolab.castor.xml.ValidationException if this
211: * object is an invalid instance according to the schema
212: * @throws org.exolab.castor.xml.MarshalException if object is
213: * null or if any SAXException is thrown during marshaling
214: */
215: public void marshal(final org.xml.sax.ContentHandler handler)
216: throws java.io.IOException,
217: org.exolab.castor.xml.MarshalException,
218: org.exolab.castor.xml.ValidationException {
219: Marshaller.marshal(this , handler);
220: }
221:
222: /**
223: * Sets the value of field 'collection'.
224: *
225: * @param collection the value of field 'collection'.
226: */
227: public void setCollection(
228: final org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType collection) {
229: this ._collection = collection;
230: }
231:
232: /**
233: * Sets the value of field 'handler'.
234: *
235: * @param handler the value of field 'handler'.
236: */
237: public void setHandler(final java.lang.String handler) {
238: this ._handler = handler;
239: }
240:
241: /**
242: * Sets the value of field 'javaType'.
243: *
244: * @param javaType the value of field 'javaType'.
245: */
246: public void setJavaType(final java.lang.String javaType) {
247: this ._javaType = javaType;
248: }
249:
250: /**
251: * Sets the value of field 'name'.
252: *
253: * @param name the value of field 'name'.
254: */
255: public void setName(final java.lang.String name) {
256: this ._name = name;
257: }
258:
259: /**
260: * Sets the value of field 'validator'.
261: *
262: * @param validator the value of field 'validator'.
263: */
264: public void setValidator(final java.lang.String validator) {
265: this ._validator = validator;
266: }
267:
268: /**
269: * Sets the value of field 'visibility'.
270: *
271: * @param visibility the value of field 'visibility'.
272: */
273: public void setVisibility(
274: final org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType visibility) {
275: this ._visibility = visibility;
276: }
277:
278: /**
279: * Sets the value of field 'wrapper'.
280: *
281: * @param wrapper the value of field 'wrapper'.
282: */
283: public void setWrapper(final boolean wrapper) {
284: this ._wrapper = wrapper;
285: this ._has_wrapper = true;
286: }
287:
288: /**
289: * Method unmarshalFieldType.
290: *
291: * @param reader
292: * @throws org.exolab.castor.xml.MarshalException if object is
293: * null or if any SAXException is thrown during marshaling
294: * @throws org.exolab.castor.xml.ValidationException if this
295: * object is an invalid instance according to the schema
296: * @return the unmarshaled
297: * org.exolab.castor.builder.binding.FieldType
298: */
299: public static org.exolab.castor.builder.binding.xml.FieldType unmarshalFieldType(
300: final java.io.Reader reader)
301: throws org.exolab.castor.xml.MarshalException,
302: org.exolab.castor.xml.ValidationException {
303: return (org.exolab.castor.builder.binding.xml.FieldType) Unmarshaller
304: .unmarshal(
305: org.exolab.castor.builder.binding.xml.FieldType.class,
306: reader);
307: }
308:
309: /**
310: *
311: *
312: * @throws org.exolab.castor.xml.ValidationException if this
313: * object is an invalid instance according to the schema
314: */
315: public void validate()
316: throws org.exolab.castor.xml.ValidationException {
317: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
318: validator.validate(this);
319: }
320:
321: }
|