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.mapping.xml;
9   
10  /**
11   * The 'field' element is used to describe the property of a Java
12   * object.
13   *  
14   * 
15   * @version $Revision$ $Date$
16   */
17  @SuppressWarnings("serial")
18  public class FieldMapping implements java.io.Serializable {
19  
20  
21        //--------------------------/
22       //- Class/Member Variables -/
23      //--------------------------/
24  
25      /**
26       * A required attribute used to identify the name of the
27       * property. 
28       *  
29       */
30      private java.lang.String _name;
31  
32      /**
33       * An optional attribute used to identify the type of the
34       * property.
35       *  
36       */
37      private java.lang.String _type;
38  
39      /**
40       * Field _required.
41       */
42      private boolean _required = false;
43  
44      /**
45       * keeps track of state for field: _required
46       */
47      private boolean _has_required;
48  
49      /**
50       * Field _transient.
51       */
52      private boolean _transient = false;
53  
54      /**
55       * keeps track of state for field: _transient
56       */
57      private boolean _has_transient;
58  
59      /**
60       * Field _nillable.
61       */
62      private boolean _nillable = false;
63  
64      /**
65       * keeps track of state for field: _nillable
66       */
67      private boolean _has_nillable;
68  
69      /**
70       * Field _direct.
71       */
72      private boolean _direct = false;
73  
74      /**
75       * keeps track of state for field: _direct
76       */
77      private boolean _has_direct;
78  
79      /**
80       * Field _lazy.
81       */
82      private boolean _lazy = false;
83  
84      /**
85       * keeps track of state for field: _lazy
86       */
87      private boolean _has_lazy;
88  
89      /**
90       * Indicates whether the field should be treated as a
91       * container, 
92       *  i.e. only it's fields should be persisted, but not the
93       * containing 
94       *  class itself. In this case, the container attribute should
95       *  be set to true (supported in Castor XML only).
96       *  
97       */
98      private boolean _container;
99  
100     /**
101      * keeps track of state for field: _container
102      */
103     private boolean _has_container;
104 
105     /**
106      * Field _getMethod.
107      */
108     private java.lang.String _getMethod;
109 
110     /**
111      * Field _hasMethod.
112      */
113     private java.lang.String _hasMethod;
114 
115     /**
116      * Field _setMethod.
117      */
118     private java.lang.String _setMethod;
119 
120     /**
121      * Field _createMethod.
122      */
123     private java.lang.String _createMethod;
124 
125     /**
126      * Field _handler.
127      */
128     private java.lang.String _handler;
129 
130     /**
131      * An optional attribute used to specify the type of the
132      * collection, if 
133      *  the property is multi-valued.
134      *  
135      */
136     private org.exolab.castor.mapping.xml.types.FieldMappingCollectionType _collection;
137 
138     /**
139      * Field _comparator.
140      */
141     private java.lang.String _comparator;
142 
143     /**
144      * Field _identity.
145      */
146     private boolean _identity = false;
147 
148     /**
149      * keeps track of state for field: _identity
150      */
151     private boolean _has_identity;
152 
153     /**
154      * Field _description.
155      */
156     private java.lang.String _description;
157 
158     /**
159      * The 'sql' element is used to store information about the
160      * database 
161      *  column to which a Java object is mapped to.
162      *  
163      */
164     private org.exolab.castor.mapping.xml.Sql _sql;
165 
166     /**
167      * The 'bind-xml' element is used for specifying XML specific
168      * databinding
169      *  properties and behavior for a specific field. 'bind-xml'
170      * may only appear
171      *  as a child of a 'field' element.
172      *  
173      */
174     private org.exolab.castor.mapping.xml.BindXml _bindXml;
175 
176     /**
177      * Field _ldap.
178      */
179     private org.exolab.castor.mapping.xml.Ldap _ldap;
180 
181 
182       //----------------/
183      //- Constructors -/
184     //----------------/
185 
186     public FieldMapping() {
187         super();
188     }
189 
190 
191       //-----------/
192      //- Methods -/
193     //-----------/
194 
195     /**
196      */
197     public void deleteContainer(
198     ) {
199         this._has_container= false;
200     }
201 
202     /**
203      */
204     public void deleteDirect(
205     ) {
206         this._has_direct= false;
207     }
208 
209     /**
210      */
211     public void deleteIdentity(
212     ) {
213         this._has_identity= false;
214     }
215 
216     /**
217      */
218     public void deleteLazy(
219     ) {
220         this._has_lazy= false;
221     }
222 
223     /**
224      */
225     public void deleteNillable(
226     ) {
227         this._has_nillable= false;
228     }
229 
230     /**
231      */
232     public void deleteRequired(
233     ) {
234         this._has_required= false;
235     }
236 
237     /**
238      */
239     public void deleteTransient(
240     ) {
241         this._has_transient= false;
242     }
243 
244     /**
245      * Returns the value of field 'bindXml'. The field 'bindXml'
246      * has the following description: The 'bind-xml' element is
247      * used for specifying XML specific databinding
248      *  properties and behavior for a specific field. 'bind-xml'
249      * may only appear
250      *  as a child of a 'field' element.
251      *  
252      * 
253      * @return the value of field 'BindXml'.
254      */
255     public org.exolab.castor.mapping.xml.BindXml getBindXml(
256     ) {
257         return this._bindXml;
258     }
259 
260     /**
261      * Returns the value of field 'collection'. The field
262      * 'collection' has the following description: An optional
263      * attribute used to specify the type of the collection, if 
264      *  the property is multi-valued.
265      *  
266      * 
267      * @return the value of field 'Collection'.
268      */
269     public org.exolab.castor.mapping.xml.types.FieldMappingCollectionType getCollection(
270     ) {
271         return this._collection;
272     }
273 
274     /**
275      * Returns the value of field 'comparator'.
276      * 
277      * @return the value of field 'Comparator'.
278      */
279     public java.lang.String getComparator(
280     ) {
281         return this._comparator;
282     }
283 
284     /**
285      * Returns the value of field 'container'. The field
286      * 'container' has the following description: Indicates whether
287      * the field should be treated as a container, 
288      *  i.e. only it's fields should be persisted, but not the
289      * containing 
290      *  class itself. In this case, the container attribute should
291      *  be set to true (supported in Castor XML only).
292      *  
293      * 
294      * @return the value of field 'Container'.
295      */
296     public boolean getContainer(
297     ) {
298         return this._container;
299     }
300 
301     /**
302      * Returns the value of field 'createMethod'.
303      * 
304      * @return the value of field 'CreateMethod'.
305      */
306     public java.lang.String getCreateMethod(
307     ) {
308         return this._createMethod;
309     }
310 
311     /**
312      * Returns the value of field 'description'.
313      * 
314      * @return the value of field 'Description'.
315      */
316     public java.lang.String getDescription(
317     ) {
318         return this._description;
319     }
320 
321     /**
322      * Returns the value of field 'direct'.
323      * 
324      * @return the value of field 'Direct'.
325      */
326     public boolean getDirect(
327     ) {
328         return this._direct;
329     }
330 
331     /**
332      * Returns the value of field 'getMethod'.
333      * 
334      * @return the value of field 'GetMethod'.
335      */
336     public java.lang.String getGetMethod(
337     ) {
338         return this._getMethod;
339     }
340 
341     /**
342      * Returns the value of field 'handler'.
343      * 
344      * @return the value of field 'Handler'.
345      */
346     public java.lang.String getHandler(
347     ) {
348         return this._handler;
349     }
350 
351     /**
352      * Returns the value of field 'hasMethod'.
353      * 
354      * @return the value of field 'HasMethod'.
355      */
356     public java.lang.String getHasMethod(
357     ) {
358         return this._hasMethod;
359     }
360 
361     /**
362      * Returns the value of field 'identity'.
363      * 
364      * @return the value of field 'Identity'.
365      */
366     public boolean getIdentity(
367     ) {
368         return this._identity;
369     }
370 
371     /**
372      * Returns the value of field 'lazy'.
373      * 
374      * @return the value of field 'Lazy'.
375      */
376     public boolean getLazy(
377     ) {
378         return this._lazy;
379     }
380 
381     /**
382      * Returns the value of field 'ldap'.
383      * 
384      * @return the value of field 'Ldap'.
385      */
386     public org.exolab.castor.mapping.xml.Ldap getLdap(
387     ) {
388         return this._ldap;
389     }
390 
391     /**
392      * Returns the value of field 'name'. The field 'name' has the
393      * following description: A required attribute used to identify
394      * the name of the property. 
395      *  
396      * 
397      * @return the value of field 'Name'.
398      */
399     public java.lang.String getName(
400     ) {
401         return this._name;
402     }
403 
404     /**
405      * Returns the value of field 'nillable'.
406      * 
407      * @return the value of field 'Nillable'.
408      */
409     public boolean getNillable(
410     ) {
411         return this._nillable;
412     }
413 
414     /**
415      * Returns the value of field 'required'.
416      * 
417      * @return the value of field 'Required'.
418      */
419     public boolean getRequired(
420     ) {
421         return this._required;
422     }
423 
424     /**
425      * Returns the value of field 'setMethod'.
426      * 
427      * @return the value of field 'SetMethod'.
428      */
429     public java.lang.String getSetMethod(
430     ) {
431         return this._setMethod;
432     }
433 
434     /**
435      * Returns the value of field 'sql'. The field 'sql' has the
436      * following description: The 'sql' element is used to store
437      * information about the database 
438      *  column to which a Java object is mapped to.
439      *  
440      * 
441      * @return the value of field 'Sql'.
442      */
443     public org.exolab.castor.mapping.xml.Sql getSql(
444     ) {
445         return this._sql;
446     }
447 
448     /**
449      * Returns the value of field 'transient'.
450      * 
451      * @return the value of field 'Transient'.
452      */
453     public boolean getTransient(
454     ) {
455         return this._transient;
456     }
457 
458     /**
459      * Returns the value of field 'type'. The field 'type' has the
460      * following description: An optional attribute used to
461      * identify the type of the property.
462      *  
463      * 
464      * @return the value of field 'Type'.
465      */
466     public java.lang.String getType(
467     ) {
468         return this._type;
469     }
470 
471     /**
472      * Method hasContainer.
473      * 
474      * @return true if at least one Container has been added
475      */
476     public boolean hasContainer(
477     ) {
478         return this._has_container;
479     }
480 
481     /**
482      * Method hasDirect.
483      * 
484      * @return true if at least one Direct has been added
485      */
486     public boolean hasDirect(
487     ) {
488         return this._has_direct;
489     }
490 
491     /**
492      * Method hasIdentity.
493      * 
494      * @return true if at least one Identity has been added
495      */
496     public boolean hasIdentity(
497     ) {
498         return this._has_identity;
499     }
500 
501     /**
502      * Method hasLazy.
503      * 
504      * @return true if at least one Lazy has been added
505      */
506     public boolean hasLazy(
507     ) {
508         return this._has_lazy;
509     }
510 
511     /**
512      * Method hasNillable.
513      * 
514      * @return true if at least one Nillable has been added
515      */
516     public boolean hasNillable(
517     ) {
518         return this._has_nillable;
519     }
520 
521     /**
522      * Method hasRequired.
523      * 
524      * @return true if at least one Required has been added
525      */
526     public boolean hasRequired(
527     ) {
528         return this._has_required;
529     }
530 
531     /**
532      * Method hasTransient.
533      * 
534      * @return true if at least one Transient has been added
535      */
536     public boolean hasTransient(
537     ) {
538         return this._has_transient;
539     }
540 
541     /**
542      * Returns the value of field 'container'. The field
543      * 'container' has the following description: Indicates whether
544      * the field should be treated as a container, 
545      *  i.e. only it's fields should be persisted, but not the
546      * containing 
547      *  class itself. In this case, the container attribute should
548      *  be set to true (supported in Castor XML only).
549      *  
550      * 
551      * @return the value of field 'Container'.
552      */
553     public boolean isContainer(
554     ) {
555         return this._container;
556     }
557 
558     /**
559      * Returns the value of field 'direct'.
560      * 
561      * @return the value of field 'Direct'.
562      */
563     public boolean isDirect(
564     ) {
565         return this._direct;
566     }
567 
568     /**
569      * Returns the value of field 'identity'.
570      * 
571      * @return the value of field 'Identity'.
572      */
573     public boolean isIdentity(
574     ) {
575         return this._identity;
576     }
577 
578     /**
579      * Returns the value of field 'lazy'.
580      * 
581      * @return the value of field 'Lazy'.
582      */
583     public boolean isLazy(
584     ) {
585         return this._lazy;
586     }
587 
588     /**
589      * Returns the value of field 'nillable'.
590      * 
591      * @return the value of field 'Nillable'.
592      */
593     public boolean isNillable(
594     ) {
595         return this._nillable;
596     }
597 
598     /**
599      * Returns the value of field 'required'.
600      * 
601      * @return the value of field 'Required'.
602      */
603     public boolean isRequired(
604     ) {
605         return this._required;
606     }
607 
608     /**
609      * Returns the value of field 'transient'.
610      * 
611      * @return the value of field 'Transient'.
612      */
613     public boolean isTransient(
614     ) {
615         return this._transient;
616     }
617 
618     /**
619      * Method isValid.
620      * 
621      * @return true if this object is valid according to the schema
622      */
623     public boolean isValid(
624     ) {
625         try {
626             validate();
627         } catch (org.exolab.castor.xml.ValidationException vex) {
628             return false;
629         }
630         return true;
631     }
632 
633     /**
634      * 
635      * 
636      * @param out
637      * @throws org.exolab.castor.xml.MarshalException if object is
638      * null or if any SAXException is thrown during marshaling
639      * @throws org.exolab.castor.xml.ValidationException if this
640      * object is an invalid instance according to the schema
641      */
642     public void marshal(
643             final java.io.Writer out)
644     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
645         org.exolab.castor.xml.Marshaller.marshal(this, out);
646     }
647 
648     /**
649      * 
650      * 
651      * @param handler
652      * @throws java.io.IOException if an IOException occurs during
653      * marshaling
654      * @throws org.exolab.castor.xml.ValidationException if this
655      * object is an invalid instance according to the schema
656      * @throws org.exolab.castor.xml.MarshalException if object is
657      * null or if any SAXException is thrown during marshaling
658      */
659     public void marshal(
660             final org.xml.sax.ContentHandler handler)
661     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
662         org.exolab.castor.xml.Marshaller.marshal(this, handler);
663     }
664 
665     /**
666      * Sets the value of field 'bindXml'. The field 'bindXml' has
667      * the following description: The 'bind-xml' element is used
668      * for specifying XML specific databinding
669      *  properties and behavior for a specific field. 'bind-xml'
670      * may only appear
671      *  as a child of a 'field' element.
672      *  
673      * 
674      * @param bindXml the value of field 'bindXml'.
675      */
676     public void setBindXml(
677             final org.exolab.castor.mapping.xml.BindXml bindXml) {
678         this._bindXml = bindXml;
679     }
680 
681     /**
682      * Sets the value of field 'collection'. The field 'collection'
683      * has the following description: An optional attribute used to
684      * specify the type of the collection, if 
685      *  the property is multi-valued.
686      *  
687      * 
688      * @param collection the value of field 'collection'.
689      */
690     public void setCollection(
691             final org.exolab.castor.mapping.xml.types.FieldMappingCollectionType collection) {
692         this._collection = collection;
693     }
694 
695     /**
696      * Sets the value of field 'comparator'.
697      * 
698      * @param comparator the value of field 'comparator'.
699      */
700     public void setComparator(
701             final java.lang.String comparator) {
702         this._comparator = comparator;
703     }
704 
705     /**
706      * Sets the value of field 'container'. The field 'container'
707      * has the following description: Indicates whether the field
708      * should be treated as a container, 
709      *  i.e. only it's fields should be persisted, but not the
710      * containing 
711      *  class itself. In this case, the container attribute should
712      *  be set to true (supported in Castor XML only).
713      *  
714      * 
715      * @param container the value of field 'container'.
716      */
717     public void setContainer(
718             final boolean container) {
719         this._container = container;
720         this._has_container = true;
721     }
722 
723     /**
724      * Sets the value of field 'createMethod'.
725      * 
726      * @param createMethod the value of field 'createMethod'.
727      */
728     public void setCreateMethod(
729             final java.lang.String createMethod) {
730         this._createMethod = createMethod;
731     }
732 
733     /**
734      * Sets the value of field 'description'.
735      * 
736      * @param description the value of field 'description'.
737      */
738     public void setDescription(
739             final java.lang.String description) {
740         this._description = description;
741     }
742 
743     /**
744      * Sets the value of field 'direct'.
745      * 
746      * @param direct the value of field 'direct'.
747      */
748     public void setDirect(
749             final boolean direct) {
750         this._direct = direct;
751         this._has_direct = true;
752     }
753 
754     /**
755      * Sets the value of field 'getMethod'.
756      * 
757      * @param getMethod the value of field 'getMethod'.
758      */
759     public void setGetMethod(
760             final java.lang.String getMethod) {
761         this._getMethod = getMethod;
762     }
763 
764     /**
765      * Sets the value of field 'handler'.
766      * 
767      * @param handler the value of field 'handler'.
768      */
769     public void setHandler(
770             final java.lang.String handler) {
771         this._handler = handler;
772     }
773 
774     /**
775      * Sets the value of field 'hasMethod'.
776      * 
777      * @param hasMethod the value of field 'hasMethod'.
778      */
779     public void setHasMethod(
780             final java.lang.String hasMethod) {
781         this._hasMethod = hasMethod;
782     }
783 
784     /**
785      * Sets the value of field 'identity'.
786      * 
787      * @param identity the value of field 'identity'.
788      */
789     public void setIdentity(
790             final boolean identity) {
791         this._identity = identity;
792         this._has_identity = true;
793     }
794 
795     /**
796      * Sets the value of field 'lazy'.
797      * 
798      * @param lazy the value of field 'lazy'.
799      */
800     public void setLazy(
801             final boolean lazy) {
802         this._lazy = lazy;
803         this._has_lazy = true;
804     }
805 
806     /**
807      * Sets the value of field 'ldap'.
808      * 
809      * @param ldap the value of field 'ldap'.
810      */
811     public void setLdap(
812             final org.exolab.castor.mapping.xml.Ldap ldap) {
813         this._ldap = ldap;
814     }
815 
816     /**
817      * Sets the value of field 'name'. The field 'name' has the
818      * following description: A required attribute used to identify
819      * the name of the property. 
820      *  
821      * 
822      * @param name the value of field 'name'.
823      */
824     public void setName(
825             final java.lang.String name) {
826         this._name = name;
827     }
828 
829     /**
830      * Sets the value of field 'nillable'.
831      * 
832      * @param nillable the value of field 'nillable'.
833      */
834     public void setNillable(
835             final boolean nillable) {
836         this._nillable = nillable;
837         this._has_nillable = true;
838     }
839 
840     /**
841      * Sets the value of field 'required'.
842      * 
843      * @param required the value of field 'required'.
844      */
845     public void setRequired(
846             final boolean required) {
847         this._required = required;
848         this._has_required = true;
849     }
850 
851     /**
852      * Sets the value of field 'setMethod'.
853      * 
854      * @param setMethod the value of field 'setMethod'.
855      */
856     public void setSetMethod(
857             final java.lang.String setMethod) {
858         this._setMethod = setMethod;
859     }
860 
861     /**
862      * Sets the value of field 'sql'. The field 'sql' has the
863      * following description: The 'sql' element is used to store
864      * information about the database 
865      *  column to which a Java object is mapped to.
866      *  
867      * 
868      * @param sql the value of field 'sql'.
869      */
870     public void setSql(
871             final org.exolab.castor.mapping.xml.Sql sql) {
872         this._sql = sql;
873     }
874 
875     /**
876      * Sets the value of field 'transient'.
877      * 
878      * @param _transient
879      * @param transient the value of field 'transient'.
880      */
881     public void setTransient(
882             final boolean _transient) {
883         this._transient = _transient;
884         this._has_transient = true;
885     }
886 
887     /**
888      * Sets the value of field 'type'. The field 'type' has the
889      * following description: An optional attribute used to
890      * identify the type of the property.
891      *  
892      * 
893      * @param type the value of field 'type'.
894      */
895     public void setType(
896             final java.lang.String type) {
897         this._type = type;
898     }
899 
900     /**
901      * Method unmarshal.
902      * 
903      * @param reader
904      * @throws org.exolab.castor.xml.MarshalException if object is
905      * null or if any SAXException is thrown during marshaling
906      * @throws org.exolab.castor.xml.ValidationException if this
907      * object is an invalid instance according to the schema
908      * @return the unmarshaled
909      * org.exolab.castor.mapping.xml.FieldMapping
910      */
911     public static org.exolab.castor.mapping.xml.FieldMapping unmarshal(
912             final java.io.Reader reader)
913     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
914         return (org.exolab.castor.mapping.xml.FieldMapping) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.FieldMapping.class, reader);
915     }
916 
917     /**
918      * 
919      * 
920      * @throws org.exolab.castor.xml.ValidationException if this
921      * object is an invalid instance according to the schema
922      */
923     public void validate(
924     )
925     throws org.exolab.castor.xml.ValidationException {
926         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
927         validator.validate(this);
928     }
929 
930 }