001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 1.0.2</a>, using an XML
004: * Schema.
005: * $Id: ClassMapping.java 6104 2006-08-23 06:32:44Z wguttmn $
006: */
007:
008: package org.exolab.castor.mapping.xml;
009:
010: import java.util.Collections;
011: import org.exolab.castor.xml.Marshaller;
012: import org.exolab.castor.xml.Unmarshaller;
013:
014: /**
015: * Class ClassMapping.
016: *
017: * @version $Revision: 6104 $ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $
018: */
019: public class ClassMapping implements java.io.Serializable {
020:
021: //--------------------------/
022: //- Class/Member Variables -/
023: //--------------------------/
024:
025: /**
026: * Field _name
027: */
028: private java.lang.String _name;
029:
030: /**
031: * Field _extends
032: */
033: private java.lang.Object _extends;
034:
035: /**
036: * Field _depends
037: */
038: private java.lang.Object _depends;
039:
040: /**
041: * Field _identity
042: */
043: private java.util.ArrayList _identity;
044:
045: /**
046: * Field _access
047: */
048: private org.exolab.castor.mapping.xml.types.ClassMappingAccessType _access = org.exolab.castor.mapping.xml.types.ClassMappingAccessType
049: .valueOf("shared");
050:
051: /**
052: * Field _keyGenerator
053: */
054: private java.lang.String _keyGenerator;
055:
056: /**
057: * Field _autoComplete
058: */
059: private boolean _autoComplete = false;
060:
061: /**
062: * keeps track of state for field: _autoComplete
063: */
064: private boolean _has_autoComplete;
065:
066: /**
067: * Field _verifyConstructable
068: */
069: private boolean _verifyConstructable = true;
070:
071: /**
072: * keeps track of state for field: _verifyConstructable
073: */
074: private boolean _has_verifyConstructable;
075:
076: /**
077: * Field _description
078: */
079: private java.lang.String _description;
080:
081: /**
082: * Field _cacheTypeMapping
083: */
084: private org.exolab.castor.mapping.xml.CacheTypeMapping _cacheTypeMapping;
085:
086: /**
087: * Field _mapTo
088: */
089: private org.exolab.castor.mapping.xml.MapTo _mapTo;
090:
091: /**
092: * Field _namedQueryList
093: */
094: private java.util.ArrayList _namedQueryList;
095:
096: /**
097: * Field _classChoice
098: */
099: private org.exolab.castor.mapping.xml.ClassChoice _classChoice;
100:
101: //----------------/
102: //- Constructors -/
103: //----------------/
104:
105: public ClassMapping() {
106: super ();
107: _identity = new java.util.ArrayList();
108: setAccess(org.exolab.castor.mapping.xml.types.ClassMappingAccessType
109: .valueOf("shared"));
110: _namedQueryList = new java.util.ArrayList();
111: } //-- org.exolab.castor.mapping.xml.ClassMapping()
112:
113: //-----------/
114: //- Methods -/
115: //-----------/
116:
117: /**
118: * Method addIdentity
119: *
120: *
121: *
122: * @param vIdentity
123: */
124: public void addIdentity(java.lang.String vIdentity)
125: throws java.lang.IndexOutOfBoundsException {
126: _identity.add(vIdentity);
127: } //-- void addIdentity(java.lang.String)
128:
129: /**
130: * Method addIdentity
131: *
132: *
133: *
134: * @param index
135: * @param vIdentity
136: */
137: public void addIdentity(int index, java.lang.String vIdentity)
138: throws java.lang.IndexOutOfBoundsException {
139: _identity.add(index, vIdentity);
140: } //-- void addIdentity(int, java.lang.String)
141:
142: /**
143: * Method addNamedQuery
144: *
145: *
146: *
147: * @param vNamedQuery
148: */
149: public void addNamedQuery(
150: org.exolab.castor.mapping.xml.NamedQuery vNamedQuery)
151: throws java.lang.IndexOutOfBoundsException {
152: _namedQueryList.add(vNamedQuery);
153: } //-- void addNamedQuery(org.exolab.castor.mapping.xml.NamedQuery)
154:
155: /**
156: * Method addNamedQuery
157: *
158: *
159: *
160: * @param index
161: * @param vNamedQuery
162: */
163: public void addNamedQuery(int index,
164: org.exolab.castor.mapping.xml.NamedQuery vNamedQuery)
165: throws java.lang.IndexOutOfBoundsException {
166: _namedQueryList.add(index, vNamedQuery);
167: } //-- void addNamedQuery(int, org.exolab.castor.mapping.xml.NamedQuery)
168:
169: /**
170: * Method clearIdentity
171: *
172: */
173: public void clearIdentity() {
174: _identity.clear();
175: } //-- void clearIdentity()
176:
177: /**
178: * Method clearNamedQuery
179: *
180: */
181: public void clearNamedQuery() {
182: _namedQueryList.clear();
183: } //-- void clearNamedQuery()
184:
185: /**
186: * Method deleteAutoComplete
187: *
188: */
189: public void deleteAutoComplete() {
190: this ._has_autoComplete = false;
191: } //-- void deleteAutoComplete()
192:
193: /**
194: * Method deleteVerifyConstructable
195: *
196: */
197: public void deleteVerifyConstructable() {
198: this ._has_verifyConstructable = false;
199: } //-- void deleteVerifyConstructable()
200:
201: /**
202: * Method enumerateIdentity
203: *
204: *
205: *
206: * @return Enumeration
207: */
208: public java.util.Enumeration enumerateIdentity() {
209: return Collections.enumeration(_identity);
210: } //-- java.util.Enumeration enumerateIdentity()
211:
212: /**
213: * Method enumerateNamedQuery
214: *
215: *
216: *
217: * @return Enumeration
218: */
219: public java.util.Enumeration enumerateNamedQuery() {
220: return Collections.enumeration(_namedQueryList);
221: } //-- java.util.Enumeration enumerateNamedQuery()
222:
223: /**
224: * Returns the value of field 'access'.
225: *
226: * @return ClassMappingAccessType
227: * @return the value of field 'access'.
228: */
229: public org.exolab.castor.mapping.xml.types.ClassMappingAccessType getAccess() {
230: return this ._access;
231: } //-- org.exolab.castor.mapping.xml.types.ClassMappingAccessType getAccess()
232:
233: /**
234: * Returns the value of field 'autoComplete'.
235: *
236: * @return boolean
237: * @return the value of field 'autoComplete'.
238: */
239: public boolean getAutoComplete() {
240: return this ._autoComplete;
241: } //-- boolean getAutoComplete()
242:
243: /**
244: * Returns the value of field 'cacheTypeMapping'.
245: *
246: * @return CacheTypeMapping
247: * @return the value of field 'cacheTypeMapping'.
248: */
249: public org.exolab.castor.mapping.xml.CacheTypeMapping getCacheTypeMapping() {
250: return this ._cacheTypeMapping;
251: } //-- org.exolab.castor.mapping.xml.CacheTypeMapping getCacheTypeMapping()
252:
253: /**
254: * Returns the value of field 'classChoice'.
255: *
256: * @return ClassChoice
257: * @return the value of field 'classChoice'.
258: */
259: public org.exolab.castor.mapping.xml.ClassChoice getClassChoice() {
260: return this ._classChoice;
261: } //-- org.exolab.castor.mapping.xml.ClassChoice getClassChoice()
262:
263: /**
264: * Returns the value of field 'depends'.
265: *
266: * @return Object
267: * @return the value of field 'depends'.
268: */
269: public java.lang.Object getDepends() {
270: return this ._depends;
271: } //-- java.lang.Object getDepends()
272:
273: /**
274: * Returns the value of field 'description'.
275: *
276: * @return String
277: * @return the value of field 'description'.
278: */
279: public java.lang.String getDescription() {
280: return this ._description;
281: } //-- java.lang.String getDescription()
282:
283: /**
284: * Returns the value of field 'extends'.
285: *
286: * @return Object
287: * @return the value of field 'extends'.
288: */
289: public java.lang.Object getExtends() {
290: return this ._extends;
291: } //-- java.lang.Object getExtends()
292:
293: /**
294: * Method getIdentity
295: *
296: *
297: *
298: * @param index
299: * @return String
300: */
301: public java.lang.String getIdentity(int index)
302: throws java.lang.IndexOutOfBoundsException {
303: //-- check bounds for index
304: if ((index < 0) || (index >= _identity.size())) {
305: throw new IndexOutOfBoundsException();
306: }
307:
308: return (String) _identity.get(index);
309: } //-- java.lang.String getIdentity(int)
310:
311: /**
312: * Method getIdentity
313: *
314: *
315: *
316: * @return String
317: */
318: public java.lang.String[] getIdentity() {
319: int size = _identity.size();
320: java.lang.String[] mArray = new java.lang.String[size];
321: for (int index = 0; index < size; index++) {
322: mArray[index] = (String) _identity.get(index);
323: }
324: return mArray;
325: } //-- java.lang.String[] getIdentity()
326:
327: /**
328: * Method getIdentityCount
329: *
330: *
331: *
332: * @return int
333: */
334: public int getIdentityCount() {
335: return _identity.size();
336: } //-- int getIdentityCount()
337:
338: /**
339: * Returns the value of field 'keyGenerator'.
340: *
341: * @return String
342: * @return the value of field 'keyGenerator'.
343: */
344: public java.lang.String getKeyGenerator() {
345: return this ._keyGenerator;
346: } //-- java.lang.String getKeyGenerator()
347:
348: /**
349: * Returns the value of field 'mapTo'.
350: *
351: * @return MapTo
352: * @return the value of field 'mapTo'.
353: */
354: public org.exolab.castor.mapping.xml.MapTo getMapTo() {
355: return this ._mapTo;
356: } //-- org.exolab.castor.mapping.xml.MapTo getMapTo()
357:
358: /**
359: * Returns the value of field 'name'.
360: *
361: * @return String
362: * @return the value of field 'name'.
363: */
364: public java.lang.String getName() {
365: return this ._name;
366: } //-- java.lang.String getName()
367:
368: /**
369: * Method getNamedQuery
370: *
371: *
372: *
373: * @param index
374: * @return NamedQuery
375: */
376: public org.exolab.castor.mapping.xml.NamedQuery getNamedQuery(
377: int index) throws java.lang.IndexOutOfBoundsException {
378: //-- check bounds for index
379: if ((index < 0) || (index >= _namedQueryList.size())) {
380: throw new IndexOutOfBoundsException();
381: }
382:
383: return (org.exolab.castor.mapping.xml.NamedQuery) _namedQueryList
384: .get(index);
385: } //-- org.exolab.castor.mapping.xml.NamedQuery getNamedQuery(int)
386:
387: /**
388: * Method getNamedQuery
389: *
390: *
391: *
392: * @return NamedQuery
393: */
394: public org.exolab.castor.mapping.xml.NamedQuery[] getNamedQuery() {
395: int size = _namedQueryList.size();
396: org.exolab.castor.mapping.xml.NamedQuery[] mArray = new org.exolab.castor.mapping.xml.NamedQuery[size];
397: for (int index = 0; index < size; index++) {
398: mArray[index] = (org.exolab.castor.mapping.xml.NamedQuery) _namedQueryList
399: .get(index);
400: }
401: return mArray;
402: } //-- org.exolab.castor.mapping.xml.NamedQuery[] getNamedQuery()
403:
404: /**
405: * Method getNamedQueryCount
406: *
407: *
408: *
409: * @return int
410: */
411: public int getNamedQueryCount() {
412: return _namedQueryList.size();
413: } //-- int getNamedQueryCount()
414:
415: /**
416: * Returns the value of field 'verifyConstructable'.
417: *
418: * @return boolean
419: * @return the value of field 'verifyConstructable'.
420: */
421: public boolean getVerifyConstructable() {
422: return this ._verifyConstructable;
423: } //-- boolean getVerifyConstructable()
424:
425: /**
426: * Method hasAutoComplete
427: *
428: *
429: *
430: * @return boolean
431: */
432: public boolean hasAutoComplete() {
433: return this ._has_autoComplete;
434: } //-- boolean hasAutoComplete()
435:
436: /**
437: * Method hasVerifyConstructable
438: *
439: *
440: *
441: * @return boolean
442: */
443: public boolean hasVerifyConstructable() {
444: return this ._has_verifyConstructable;
445: } //-- boolean hasVerifyConstructable()
446:
447: /**
448: * Method isValid
449: *
450: *
451: *
452: * @return boolean
453: */
454: public boolean isValid() {
455: try {
456: validate();
457: } catch (org.exolab.castor.xml.ValidationException vex) {
458: return false;
459: }
460: return true;
461: } //-- boolean isValid()
462:
463: /**
464: * Method marshal
465: *
466: *
467: *
468: * @param out
469: */
470: public void marshal(java.io.Writer out)
471: throws org.exolab.castor.xml.MarshalException,
472: org.exolab.castor.xml.ValidationException {
473:
474: Marshaller.marshal(this , out);
475: } //-- void marshal(java.io.Writer)
476:
477: /**
478: * Method marshal
479: *
480: *
481: *
482: * @param handler
483: */
484: public void marshal(org.xml.sax.ContentHandler handler)
485: throws java.io.IOException,
486: org.exolab.castor.xml.MarshalException,
487: org.exolab.castor.xml.ValidationException {
488:
489: Marshaller.marshal(this , handler);
490: } //-- void marshal(org.xml.sax.ContentHandler)
491:
492: /**
493: * Method removeIdentity
494: *
495: *
496: *
497: * @param vIdentity
498: * @return boolean
499: */
500: public boolean removeIdentity(java.lang.String vIdentity) {
501: boolean removed = _identity.remove(vIdentity);
502: return removed;
503: } //-- boolean removeIdentity(java.lang.String)
504:
505: /**
506: * Method removeNamedQuery
507: *
508: *
509: *
510: * @param vNamedQuery
511: * @return boolean
512: */
513: public boolean removeNamedQuery(
514: org.exolab.castor.mapping.xml.NamedQuery vNamedQuery) {
515: boolean removed = _namedQueryList.remove(vNamedQuery);
516: return removed;
517: } //-- boolean removeNamedQuery(org.exolab.castor.mapping.xml.NamedQuery)
518:
519: /**
520: * Sets the value of field 'access'.
521: *
522: * @param access the value of field 'access'.
523: */
524: public void setAccess(
525: org.exolab.castor.mapping.xml.types.ClassMappingAccessType access) {
526: this ._access = access;
527: } //-- void setAccess(org.exolab.castor.mapping.xml.types.ClassMappingAccessType)
528:
529: /**
530: * Sets the value of field 'autoComplete'.
531: *
532: * @param autoComplete the value of field 'autoComplete'.
533: */
534: public void setAutoComplete(boolean autoComplete) {
535: this ._autoComplete = autoComplete;
536: this ._has_autoComplete = true;
537: } //-- void setAutoComplete(boolean)
538:
539: /**
540: * Sets the value of field 'cacheTypeMapping'.
541: *
542: * @param cacheTypeMapping the value of field 'cacheTypeMapping'
543: */
544: public void setCacheTypeMapping(
545: org.exolab.castor.mapping.xml.CacheTypeMapping cacheTypeMapping) {
546: this ._cacheTypeMapping = cacheTypeMapping;
547: } //-- void setCacheTypeMapping(org.exolab.castor.mapping.xml.CacheTypeMapping)
548:
549: /**
550: * Sets the value of field 'classChoice'.
551: *
552: * @param classChoice the value of field 'classChoice'.
553: */
554: public void setClassChoice(
555: org.exolab.castor.mapping.xml.ClassChoice classChoice) {
556: this ._classChoice = classChoice;
557: } //-- void setClassChoice(org.exolab.castor.mapping.xml.ClassChoice)
558:
559: /**
560: * Sets the value of field 'depends'.
561: *
562: * @param depends the value of field 'depends'.
563: */
564: public void setDepends(java.lang.Object depends) {
565: this ._depends = depends;
566: } //-- void setDepends(java.lang.Object)
567:
568: /**
569: * Sets the value of field 'description'.
570: *
571: * @param description the value of field 'description'.
572: */
573: public void setDescription(java.lang.String description) {
574: this ._description = description;
575: } //-- void setDescription(java.lang.String)
576:
577: /**
578: * Sets the value of field 'extends'.
579: *
580: * @param _extends
581: * @param extends the value of field 'extends'.
582: */
583: public void setExtends(java.lang.Object _extends) {
584: this ._extends = _extends;
585: } //-- void setExtends(java.lang.Object)
586:
587: /**
588: * Method setIdentity
589: *
590: *
591: *
592: * @param index
593: * @param vIdentity
594: */
595: public void setIdentity(int index, java.lang.String vIdentity)
596: throws java.lang.IndexOutOfBoundsException {
597: //-- check bounds for index
598: if ((index < 0) || (index >= _identity.size())) {
599: throw new IndexOutOfBoundsException();
600: }
601: _identity.set(index, vIdentity);
602: } //-- void setIdentity(int, java.lang.String)
603:
604: /**
605: * Method setIdentity
606: *
607: *
608: *
609: * @param identityArray
610: */
611: public void setIdentity(java.lang.String[] identityArray) {
612: //-- copy array
613: _identity.clear();
614: for (int i = 0; i < identityArray.length; i++) {
615: _identity.add(identityArray[i]);
616: }
617: } //-- void setIdentity(java.lang.String)
618:
619: /**
620: * Sets the value of field 'keyGenerator'.
621: *
622: * @param keyGenerator the value of field 'keyGenerator'.
623: */
624: public void setKeyGenerator(java.lang.String keyGenerator) {
625: this ._keyGenerator = keyGenerator;
626: } //-- void setKeyGenerator(java.lang.String)
627:
628: /**
629: * Sets the value of field 'mapTo'.
630: *
631: * @param mapTo the value of field 'mapTo'.
632: */
633: public void setMapTo(org.exolab.castor.mapping.xml.MapTo mapTo) {
634: this ._mapTo = mapTo;
635: } //-- void setMapTo(org.exolab.castor.mapping.xml.MapTo)
636:
637: /**
638: * Sets the value of field 'name'.
639: *
640: * @param name the value of field 'name'.
641: */
642: public void setName(java.lang.String name) {
643: this ._name = name;
644: } //-- void setName(java.lang.String)
645:
646: /**
647: * Method setNamedQuery
648: *
649: *
650: *
651: * @param index
652: * @param vNamedQuery
653: */
654: public void setNamedQuery(int index,
655: org.exolab.castor.mapping.xml.NamedQuery vNamedQuery)
656: throws java.lang.IndexOutOfBoundsException {
657: //-- check bounds for index
658: if ((index < 0) || (index >= _namedQueryList.size())) {
659: throw new IndexOutOfBoundsException();
660: }
661: _namedQueryList.set(index, vNamedQuery);
662: } //-- void setNamedQuery(int, org.exolab.castor.mapping.xml.NamedQuery)
663:
664: /**
665: * Method setNamedQuery
666: *
667: *
668: *
669: * @param namedQueryArray
670: */
671: public void setNamedQuery(
672: org.exolab.castor.mapping.xml.NamedQuery[] namedQueryArray) {
673: //-- copy array
674: _namedQueryList.clear();
675: for (int i = 0; i < namedQueryArray.length; i++) {
676: _namedQueryList.add(namedQueryArray[i]);
677: }
678: } //-- void setNamedQuery(org.exolab.castor.mapping.xml.NamedQuery)
679:
680: /**
681: * Sets the value of field 'verifyConstructable'.
682: *
683: * @param verifyConstructable the value of field
684: * 'verifyConstructable'.
685: */
686: public void setVerifyConstructable(boolean verifyConstructable) {
687: this ._verifyConstructable = verifyConstructable;
688: this ._has_verifyConstructable = true;
689: } //-- void setVerifyConstructable(boolean)
690:
691: /**
692: * Method unmarshal
693: *
694: *
695: *
696: * @param reader
697: * @return ClassMapping
698: */
699: public static org.exolab.castor.mapping.xml.ClassMapping unmarshal(
700: java.io.Reader reader)
701: throws org.exolab.castor.xml.MarshalException,
702: org.exolab.castor.xml.ValidationException {
703: return (org.exolab.castor.mapping.xml.ClassMapping) Unmarshaller
704: .unmarshal(
705: org.exolab.castor.mapping.xml.ClassMapping.class,
706: reader);
707: } //-- org.exolab.castor.mapping.xml.ClassMapping unmarshal(java.io.Reader)
708:
709: /**
710: * Method validate
711: *
712: */
713: public void validate()
714: throws org.exolab.castor.xml.ValidationException {
715: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
716: validator.validate(this );
717: } //-- void validate()
718:
719: }
|