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: ClassChoice.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 ClassChoice.
016: *
017: * @version $Revision: 6104 $ $Date$
018: */
019: public class ClassChoice implements java.io.Serializable {
020:
021: //--------------------------/
022: //- Class/Member Variables -/
023: //--------------------------/
024:
025: /**
026: * Field _fieldMappingList
027: */
028: private java.util.ArrayList _fieldMappingList;
029:
030: /**
031: * Field _containerList
032: */
033: private java.util.ArrayList _containerList;
034:
035: //----------------/
036: //- Constructors -/
037: //----------------/
038:
039: public ClassChoice() {
040: super ();
041: _fieldMappingList = new java.util.ArrayList();
042: _containerList = new java.util.ArrayList();
043: } //-- org.exolab.castor.mapping.xml.ClassChoice()
044:
045: //-----------/
046: //- Methods -/
047: //-----------/
048:
049: /**
050: * Method addContainer
051: *
052: *
053: *
054: * @param vContainer
055: */
056: public void addContainer(
057: org.exolab.castor.mapping.xml.Container vContainer)
058: throws java.lang.IndexOutOfBoundsException {
059: _containerList.add(vContainer);
060: } //-- void addContainer(org.exolab.castor.mapping.xml.Container)
061:
062: /**
063: * Method addContainer
064: *
065: *
066: *
067: * @param index
068: * @param vContainer
069: */
070: public void addContainer(int index,
071: org.exolab.castor.mapping.xml.Container vContainer)
072: throws java.lang.IndexOutOfBoundsException {
073: _containerList.add(index, vContainer);
074: } //-- void addContainer(int, org.exolab.castor.mapping.xml.Container)
075:
076: /**
077: * Method addFieldMapping
078: *
079: *
080: *
081: * @param vFieldMapping
082: */
083: public void addFieldMapping(
084: org.exolab.castor.mapping.xml.FieldMapping vFieldMapping)
085: throws java.lang.IndexOutOfBoundsException {
086: _fieldMappingList.add(vFieldMapping);
087: } //-- void addFieldMapping(org.exolab.castor.mapping.xml.FieldMapping)
088:
089: /**
090: * Method addFieldMapping
091: *
092: *
093: *
094: * @param index
095: * @param vFieldMapping
096: */
097: public void addFieldMapping(int index,
098: org.exolab.castor.mapping.xml.FieldMapping vFieldMapping)
099: throws java.lang.IndexOutOfBoundsException {
100: _fieldMappingList.add(index, vFieldMapping);
101: } //-- void addFieldMapping(int, org.exolab.castor.mapping.xml.FieldMapping)
102:
103: /**
104: * Method clearContainer
105: *
106: */
107: public void clearContainer() {
108: _containerList.clear();
109: } //-- void clearContainer()
110:
111: /**
112: * Method clearFieldMapping
113: *
114: */
115: public void clearFieldMapping() {
116: _fieldMappingList.clear();
117: } //-- void clearFieldMapping()
118:
119: /**
120: * Method enumerateContainer
121: *
122: *
123: *
124: * @return Enumeration
125: */
126: public java.util.Enumeration enumerateContainer() {
127: return Collections.enumeration(_containerList);
128: } //-- java.util.Enumeration enumerateContainer()
129:
130: /**
131: * Method enumerateFieldMapping
132: *
133: *
134: *
135: * @return Enumeration
136: */
137: public java.util.Enumeration enumerateFieldMapping() {
138: return Collections.enumeration(_fieldMappingList);
139: } //-- java.util.Enumeration enumerateFieldMapping()
140:
141: /**
142: * Method getContainer
143: *
144: *
145: *
146: * @param index
147: * @return Container
148: */
149: public org.exolab.castor.mapping.xml.Container getContainer(
150: int index) throws java.lang.IndexOutOfBoundsException {
151: //-- check bounds for index
152: if ((index < 0) || (index >= _containerList.size())) {
153: throw new IndexOutOfBoundsException();
154: }
155:
156: return (org.exolab.castor.mapping.xml.Container) _containerList
157: .get(index);
158: } //-- org.exolab.castor.mapping.xml.Container getContainer(int)
159:
160: /**
161: * Method getContainer
162: *
163: *
164: *
165: * @return Container
166: */
167: public org.exolab.castor.mapping.xml.Container[] getContainer() {
168: int size = _containerList.size();
169: org.exolab.castor.mapping.xml.Container[] mArray = new org.exolab.castor.mapping.xml.Container[size];
170: for (int index = 0; index < size; index++) {
171: mArray[index] = (org.exolab.castor.mapping.xml.Container) _containerList
172: .get(index);
173: }
174: return mArray;
175: } //-- org.exolab.castor.mapping.xml.Container[] getContainer()
176:
177: /**
178: * Method getContainerCount
179: *
180: *
181: *
182: * @return int
183: */
184: public int getContainerCount() {
185: return _containerList.size();
186: } //-- int getContainerCount()
187:
188: /**
189: * Method getFieldMapping
190: *
191: *
192: *
193: * @param index
194: * @return FieldMapping
195: */
196: public org.exolab.castor.mapping.xml.FieldMapping getFieldMapping(
197: int index) throws java.lang.IndexOutOfBoundsException {
198: //-- check bounds for index
199: if ((index < 0) || (index >= _fieldMappingList.size())) {
200: throw new IndexOutOfBoundsException();
201: }
202:
203: return (org.exolab.castor.mapping.xml.FieldMapping) _fieldMappingList
204: .get(index);
205: } //-- org.exolab.castor.mapping.xml.FieldMapping getFieldMapping(int)
206:
207: /**
208: * Method getFieldMapping
209: *
210: *
211: *
212: * @return FieldMapping
213: */
214: public org.exolab.castor.mapping.xml.FieldMapping[] getFieldMapping() {
215: int size = _fieldMappingList.size();
216: org.exolab.castor.mapping.xml.FieldMapping[] mArray = new org.exolab.castor.mapping.xml.FieldMapping[size];
217: for (int index = 0; index < size; index++) {
218: mArray[index] = (org.exolab.castor.mapping.xml.FieldMapping) _fieldMappingList
219: .get(index);
220: }
221: return mArray;
222: } //-- org.exolab.castor.mapping.xml.FieldMapping[] getFieldMapping()
223:
224: /**
225: * Method getFieldMappingCount
226: *
227: *
228: *
229: * @return int
230: */
231: public int getFieldMappingCount() {
232: return _fieldMappingList.size();
233: } //-- int getFieldMappingCount()
234:
235: /**
236: * Method isValid
237: *
238: *
239: *
240: * @return boolean
241: */
242: public boolean isValid() {
243: try {
244: validate();
245: } catch (org.exolab.castor.xml.ValidationException vex) {
246: return false;
247: }
248: return true;
249: } //-- boolean isValid()
250:
251: /**
252: * Method marshal
253: *
254: *
255: *
256: * @param out
257: */
258: public void marshal(java.io.Writer out)
259: throws org.exolab.castor.xml.MarshalException,
260: org.exolab.castor.xml.ValidationException {
261:
262: Marshaller.marshal(this , out);
263: } //-- void marshal(java.io.Writer)
264:
265: /**
266: * Method marshal
267: *
268: *
269: *
270: * @param handler
271: */
272: public void marshal(org.xml.sax.ContentHandler handler)
273: throws java.io.IOException,
274: org.exolab.castor.xml.MarshalException,
275: org.exolab.castor.xml.ValidationException {
276:
277: Marshaller.marshal(this , handler);
278: } //-- void marshal(org.xml.sax.ContentHandler)
279:
280: /**
281: * Method removeContainer
282: *
283: *
284: *
285: * @param vContainer
286: * @return boolean
287: */
288: public boolean removeContainer(
289: org.exolab.castor.mapping.xml.Container vContainer) {
290: boolean removed = _containerList.remove(vContainer);
291: return removed;
292: } //-- boolean removeContainer(org.exolab.castor.mapping.xml.Container)
293:
294: /**
295: * Method removeFieldMapping
296: *
297: *
298: *
299: * @param vFieldMapping
300: * @return boolean
301: */
302: public boolean removeFieldMapping(
303: org.exolab.castor.mapping.xml.FieldMapping vFieldMapping) {
304: boolean removed = _fieldMappingList.remove(vFieldMapping);
305: return removed;
306: } //-- boolean removeFieldMapping(org.exolab.castor.mapping.xml.FieldMapping)
307:
308: /**
309: * Method setContainer
310: *
311: *
312: *
313: * @param index
314: * @param vContainer
315: */
316: public void setContainer(int index,
317: org.exolab.castor.mapping.xml.Container vContainer)
318: throws java.lang.IndexOutOfBoundsException {
319: //-- check bounds for index
320: if ((index < 0) || (index >= _containerList.size())) {
321: throw new IndexOutOfBoundsException();
322: }
323: _containerList.set(index, vContainer);
324: } //-- void setContainer(int, org.exolab.castor.mapping.xml.Container)
325:
326: /**
327: * Method setContainer
328: *
329: *
330: *
331: * @param containerArray
332: */
333: public void setContainer(
334: org.exolab.castor.mapping.xml.Container[] containerArray) {
335: //-- copy array
336: _containerList.clear();
337: for (int i = 0; i < containerArray.length; i++) {
338: _containerList.add(containerArray[i]);
339: }
340: } //-- void setContainer(org.exolab.castor.mapping.xml.Container)
341:
342: /**
343: * Method setFieldMapping
344: *
345: *
346: *
347: * @param index
348: * @param vFieldMapping
349: */
350: public void setFieldMapping(int index,
351: org.exolab.castor.mapping.xml.FieldMapping vFieldMapping)
352: throws java.lang.IndexOutOfBoundsException {
353: //-- check bounds for index
354: if ((index < 0) || (index >= _fieldMappingList.size())) {
355: throw new IndexOutOfBoundsException();
356: }
357: _fieldMappingList.set(index, vFieldMapping);
358: } //-- void setFieldMapping(int, org.exolab.castor.mapping.xml.FieldMapping)
359:
360: /**
361: * Method setFieldMapping
362: *
363: *
364: *
365: * @param fieldMappingArray
366: */
367: public void setFieldMapping(
368: org.exolab.castor.mapping.xml.FieldMapping[] fieldMappingArray) {
369: //-- copy array
370: _fieldMappingList.clear();
371: for (int i = 0; i < fieldMappingArray.length; i++) {
372: _fieldMappingList.add(fieldMappingArray[i]);
373: }
374: } //-- void setFieldMapping(org.exolab.castor.mapping.xml.FieldMapping)
375:
376: /**
377: * Method unmarshal
378: *
379: *
380: *
381: * @param reader
382: * @return ClassChoice
383: */
384: public static org.exolab.castor.mapping.xml.ClassChoice unmarshal(
385: java.io.Reader reader)
386: throws org.exolab.castor.xml.MarshalException,
387: org.exolab.castor.xml.ValidationException {
388: return (org.exolab.castor.mapping.xml.ClassChoice) Unmarshaller
389: .unmarshal(
390: org.exolab.castor.mapping.xml.ClassChoice.class,
391: reader);
392: } //-- org.exolab.castor.mapping.xml.ClassChoice unmarshal(java.io.Reader)
393:
394: /**
395: * Method validate
396: *
397: */
398: public void validate()
399: throws org.exolab.castor.xml.ValidationException {
400: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
401: validator.validate(this );
402: } //-- void validate()
403:
404: }
|