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: Sql.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 Sql.
016: *
017: * @version $Revision: 6104 $ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $
018: */
019: public class Sql implements java.io.Serializable {
020:
021: //--------------------------/
022: //- Class/Member Variables -/
023: //--------------------------/
024:
025: /**
026: * Field _name
027: */
028: private java.util.ArrayList _name;
029:
030: /**
031: * Field _type
032: */
033: private java.lang.String _type;
034:
035: /**
036: * Field _manyTable
037: */
038: private java.lang.String _manyTable;
039:
040: /**
041: * Field _manyKey
042: */
043: private java.util.ArrayList _manyKey;
044:
045: /**
046: * Field _readOnly
047: */
048: private boolean _readOnly = false;
049:
050: /**
051: * keeps track of state for field: _readOnly
052: */
053: private boolean _has_readOnly;
054:
055: /**
056: * Field _transient
057: */
058: private boolean _transient;
059:
060: /**
061: * keeps track of state for field: _transient
062: */
063: private boolean _has_transient;
064:
065: /**
066: * Field _dirty
067: */
068: private org.exolab.castor.mapping.xml.types.SqlDirtyType _dirty = org.exolab.castor.mapping.xml.types.SqlDirtyType
069: .valueOf("check");
070:
071: //----------------/
072: //- Constructors -/
073: //----------------/
074:
075: public Sql() {
076: super ();
077: _name = new java.util.ArrayList();
078: _manyKey = new java.util.ArrayList();
079: setDirty(org.exolab.castor.mapping.xml.types.SqlDirtyType
080: .valueOf("check"));
081: } //-- org.exolab.castor.mapping.xml.Sql()
082:
083: //-----------/
084: //- Methods -/
085: //-----------/
086:
087: /**
088: * Method addManyKey
089: *
090: *
091: *
092: * @param vManyKey
093: */
094: public void addManyKey(java.lang.String vManyKey)
095: throws java.lang.IndexOutOfBoundsException {
096: _manyKey.add(vManyKey);
097: } //-- void addManyKey(java.lang.String)
098:
099: /**
100: * Method addManyKey
101: *
102: *
103: *
104: * @param index
105: * @param vManyKey
106: */
107: public void addManyKey(int index, java.lang.String vManyKey)
108: throws java.lang.IndexOutOfBoundsException {
109: _manyKey.add(index, vManyKey);
110: } //-- void addManyKey(int, java.lang.String)
111:
112: /**
113: * Method addName
114: *
115: *
116: *
117: * @param vName
118: */
119: public void addName(java.lang.String vName)
120: throws java.lang.IndexOutOfBoundsException {
121: _name.add(vName);
122: } //-- void addName(java.lang.String)
123:
124: /**
125: * Method addName
126: *
127: *
128: *
129: * @param index
130: * @param vName
131: */
132: public void addName(int index, java.lang.String vName)
133: throws java.lang.IndexOutOfBoundsException {
134: _name.add(index, vName);
135: } //-- void addName(int, java.lang.String)
136:
137: /**
138: * Method clearManyKey
139: *
140: */
141: public void clearManyKey() {
142: _manyKey.clear();
143: } //-- void clearManyKey()
144:
145: /**
146: * Method clearName
147: *
148: */
149: public void clearName() {
150: _name.clear();
151: } //-- void clearName()
152:
153: /**
154: * Method deleteReadOnly
155: *
156: */
157: public void deleteReadOnly() {
158: this ._has_readOnly = false;
159: } //-- void deleteReadOnly()
160:
161: /**
162: * Method deleteTransient
163: *
164: */
165: public void deleteTransient() {
166: this ._has_transient = false;
167: } //-- void deleteTransient()
168:
169: /**
170: * Method enumerateManyKey
171: *
172: *
173: *
174: * @return Enumeration
175: */
176: public java.util.Enumeration enumerateManyKey() {
177: return Collections.enumeration(_manyKey);
178: } //-- java.util.Enumeration enumerateManyKey()
179:
180: /**
181: * Method enumerateName
182: *
183: *
184: *
185: * @return Enumeration
186: */
187: public java.util.Enumeration enumerateName() {
188: return Collections.enumeration(_name);
189: } //-- java.util.Enumeration enumerateName()
190:
191: /**
192: * Returns the value of field 'dirty'.
193: *
194: * @return SqlDirtyType
195: * @return the value of field 'dirty'.
196: */
197: public org.exolab.castor.mapping.xml.types.SqlDirtyType getDirty() {
198: return this ._dirty;
199: } //-- org.exolab.castor.mapping.xml.types.SqlDirtyType getDirty()
200:
201: /**
202: * Method getManyKey
203: *
204: *
205: *
206: * @param index
207: * @return String
208: */
209: public java.lang.String getManyKey(int index)
210: throws java.lang.IndexOutOfBoundsException {
211: //-- check bounds for index
212: if ((index < 0) || (index >= _manyKey.size())) {
213: throw new IndexOutOfBoundsException();
214: }
215:
216: return (String) _manyKey.get(index);
217: } //-- java.lang.String getManyKey(int)
218:
219: /**
220: * Method getManyKey
221: *
222: *
223: *
224: * @return String
225: */
226: public java.lang.String[] getManyKey() {
227: int size = _manyKey.size();
228: java.lang.String[] mArray = new java.lang.String[size];
229: for (int index = 0; index < size; index++) {
230: mArray[index] = (String) _manyKey.get(index);
231: }
232: return mArray;
233: } //-- java.lang.String[] getManyKey()
234:
235: /**
236: * Method getManyKeyCount
237: *
238: *
239: *
240: * @return int
241: */
242: public int getManyKeyCount() {
243: return _manyKey.size();
244: } //-- int getManyKeyCount()
245:
246: /**
247: * Returns the value of field 'manyTable'.
248: *
249: * @return String
250: * @return the value of field 'manyTable'.
251: */
252: public java.lang.String getManyTable() {
253: return this ._manyTable;
254: } //-- java.lang.String getManyTable()
255:
256: /**
257: * Method getName
258: *
259: *
260: *
261: * @param index
262: * @return String
263: */
264: public java.lang.String getName(int index)
265: throws java.lang.IndexOutOfBoundsException {
266: //-- check bounds for index
267: if ((index < 0) || (index >= _name.size())) {
268: throw new IndexOutOfBoundsException();
269: }
270:
271: return (String) _name.get(index);
272: } //-- java.lang.String getName(int)
273:
274: /**
275: * Method getName
276: *
277: *
278: *
279: * @return String
280: */
281: public java.lang.String[] getName() {
282: int size = _name.size();
283: java.lang.String[] mArray = new java.lang.String[size];
284: for (int index = 0; index < size; index++) {
285: mArray[index] = (String) _name.get(index);
286: }
287: return mArray;
288: } //-- java.lang.String[] getName()
289:
290: /**
291: * Method getNameCount
292: *
293: *
294: *
295: * @return int
296: */
297: public int getNameCount() {
298: return _name.size();
299: } //-- int getNameCount()
300:
301: /**
302: * Returns the value of field 'readOnly'.
303: *
304: * @return boolean
305: * @return the value of field 'readOnly'.
306: */
307: public boolean getReadOnly() {
308: return this ._readOnly;
309: } //-- boolean getReadOnly()
310:
311: /**
312: * Returns the value of field 'transient'.
313: *
314: * @return boolean
315: * @return the value of field 'transient'.
316: */
317: public boolean getTransient() {
318: return this ._transient;
319: } //-- boolean getTransient()
320:
321: /**
322: * Returns the value of field 'type'.
323: *
324: * @return String
325: * @return the value of field 'type'.
326: */
327: public java.lang.String getType() {
328: return this ._type;
329: } //-- java.lang.String getType()
330:
331: /**
332: * Method hasReadOnly
333: *
334: *
335: *
336: * @return boolean
337: */
338: public boolean hasReadOnly() {
339: return this ._has_readOnly;
340: } //-- boolean hasReadOnly()
341:
342: /**
343: * Method hasTransient
344: *
345: *
346: *
347: * @return boolean
348: */
349: public boolean hasTransient() {
350: return this ._has_transient;
351: } //-- boolean hasTransient()
352:
353: /**
354: * Method isValid
355: *
356: *
357: *
358: * @return boolean
359: */
360: public boolean isValid() {
361: try {
362: validate();
363: } catch (org.exolab.castor.xml.ValidationException vex) {
364: return false;
365: }
366: return true;
367: } //-- boolean isValid()
368:
369: /**
370: * Method marshal
371: *
372: *
373: *
374: * @param out
375: */
376: public void marshal(java.io.Writer out)
377: throws org.exolab.castor.xml.MarshalException,
378: org.exolab.castor.xml.ValidationException {
379:
380: Marshaller.marshal(this , out);
381: } //-- void marshal(java.io.Writer)
382:
383: /**
384: * Method marshal
385: *
386: *
387: *
388: * @param handler
389: */
390: public void marshal(org.xml.sax.ContentHandler handler)
391: throws java.io.IOException,
392: org.exolab.castor.xml.MarshalException,
393: org.exolab.castor.xml.ValidationException {
394:
395: Marshaller.marshal(this , handler);
396: } //-- void marshal(org.xml.sax.ContentHandler)
397:
398: /**
399: * Method removeManyKey
400: *
401: *
402: *
403: * @param vManyKey
404: * @return boolean
405: */
406: public boolean removeManyKey(java.lang.String vManyKey) {
407: boolean removed = _manyKey.remove(vManyKey);
408: return removed;
409: } //-- boolean removeManyKey(java.lang.String)
410:
411: /**
412: * Method removeName
413: *
414: *
415: *
416: * @param vName
417: * @return boolean
418: */
419: public boolean removeName(java.lang.String vName) {
420: boolean removed = _name.remove(vName);
421: return removed;
422: } //-- boolean removeName(java.lang.String)
423:
424: /**
425: * Sets the value of field 'dirty'.
426: *
427: * @param dirty the value of field 'dirty'.
428: */
429: public void setDirty(
430: org.exolab.castor.mapping.xml.types.SqlDirtyType dirty) {
431: this ._dirty = dirty;
432: } //-- void setDirty(org.exolab.castor.mapping.xml.types.SqlDirtyType)
433:
434: /**
435: * Method setManyKey
436: *
437: *
438: *
439: * @param index
440: * @param vManyKey
441: */
442: public void setManyKey(int index, java.lang.String vManyKey)
443: throws java.lang.IndexOutOfBoundsException {
444: //-- check bounds for index
445: if ((index < 0) || (index >= _manyKey.size())) {
446: throw new IndexOutOfBoundsException();
447: }
448: _manyKey.set(index, vManyKey);
449: } //-- void setManyKey(int, java.lang.String)
450:
451: /**
452: * Method setManyKey
453: *
454: *
455: *
456: * @param manyKeyArray
457: */
458: public void setManyKey(java.lang.String[] manyKeyArray) {
459: //-- copy array
460: _manyKey.clear();
461: for (int i = 0; i < manyKeyArray.length; i++) {
462: _manyKey.add(manyKeyArray[i]);
463: }
464: } //-- void setManyKey(java.lang.String)
465:
466: /**
467: * Sets the value of field 'manyTable'.
468: *
469: * @param manyTable the value of field 'manyTable'.
470: */
471: public void setManyTable(java.lang.String manyTable) {
472: this ._manyTable = manyTable;
473: } //-- void setManyTable(java.lang.String)
474:
475: /**
476: * Method setName
477: *
478: *
479: *
480: * @param index
481: * @param vName
482: */
483: public void setName(int index, java.lang.String vName)
484: throws java.lang.IndexOutOfBoundsException {
485: //-- check bounds for index
486: if ((index < 0) || (index >= _name.size())) {
487: throw new IndexOutOfBoundsException();
488: }
489: _name.set(index, vName);
490: } //-- void setName(int, java.lang.String)
491:
492: /**
493: * Method setName
494: *
495: *
496: *
497: * @param nameArray
498: */
499: public void setName(java.lang.String[] nameArray) {
500: //-- copy array
501: _name.clear();
502: for (int i = 0; i < nameArray.length; i++) {
503: _name.add(nameArray[i]);
504: }
505: } //-- void setName(java.lang.String)
506:
507: /**
508: * Sets the value of field 'readOnly'.
509: *
510: * @param readOnly the value of field 'readOnly'.
511: */
512: public void setReadOnly(boolean readOnly) {
513: this ._readOnly = readOnly;
514: this ._has_readOnly = true;
515: } //-- void setReadOnly(boolean)
516:
517: /**
518: * Sets the value of field 'transient'.
519: *
520: * @param _transient
521: * @param transient the value of field 'transient'.
522: */
523: public void setTransient(boolean _transient) {
524: this ._transient = _transient;
525: this ._has_transient = true;
526: } //-- void setTransient(boolean)
527:
528: /**
529: * Sets the value of field 'type'.
530: *
531: * @param type the value of field 'type'.
532: */
533: public void setType(java.lang.String type) {
534: this ._type = type;
535: } //-- void setType(java.lang.String)
536:
537: /**
538: * Method unmarshal
539: *
540: *
541: *
542: * @param reader
543: * @return Sql
544: */
545: public static org.exolab.castor.mapping.xml.Sql unmarshal(
546: java.io.Reader reader)
547: throws org.exolab.castor.xml.MarshalException,
548: org.exolab.castor.xml.ValidationException {
549: return (org.exolab.castor.mapping.xml.Sql) Unmarshaller
550: .unmarshal(org.exolab.castor.mapping.xml.Sql.class,
551: reader);
552: } //-- org.exolab.castor.mapping.xml.Sql unmarshal(java.io.Reader)
553:
554: /**
555: * Method validate
556: *
557: */
558: public void validate()
559: throws org.exolab.castor.xml.ValidationException {
560: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
561: validator.validate(this );
562: } //-- void validate()
563:
564: }
|