001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
004: * Schema.
005: * $Id$
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: * Class Excludes.
019: *
020: * @version $Revision$ $Date$
021: */
022: public class Excludes implements java.io.Serializable {
023:
024: //--------------------------/
025: //- Class/Member Variables -/
026: //--------------------------/
027:
028: /**
029: * Field _excludeList.
030: */
031: private java.util.List _excludeList;
032:
033: //----------------/
034: //- Constructors -/
035: //----------------/
036:
037: public Excludes() {
038: super ();
039: this ._excludeList = new java.util.ArrayList();
040: }
041:
042: //-----------/
043: //- Methods -/
044: //-----------/
045:
046: /**
047: *
048: *
049: * @param vExclude
050: * @throws java.lang.IndexOutOfBoundsException if the index
051: * given is outside the bounds of the collection
052: */
053: public void addExclude(
054: final org.exolab.castor.builder.binding.xml.Exclude vExclude)
055: throws java.lang.IndexOutOfBoundsException {
056: this ._excludeList.add(vExclude);
057: }
058:
059: /**
060: *
061: *
062: * @param index
063: * @param vExclude
064: * @throws java.lang.IndexOutOfBoundsException if the index
065: * given is outside the bounds of the collection
066: */
067: public void addExclude(final int index,
068: final org.exolab.castor.builder.binding.xml.Exclude vExclude)
069: throws java.lang.IndexOutOfBoundsException {
070: this ._excludeList.add(index, vExclude);
071: }
072:
073: /**
074: * Method enumerateExclude.
075: *
076: * @return an Enumeration over all possible elements of this
077: * collection
078: */
079: public java.util.Enumeration enumerateExclude() {
080: return java.util.Collections.enumeration(this ._excludeList);
081: }
082:
083: /**
084: * Method getExclude.
085: *
086: * @param index
087: * @throws java.lang.IndexOutOfBoundsException if the index
088: * given is outside the bounds of the collection
089: * @return the value of the
090: * org.exolab.castor.builder.binding.xml.Exclude at the given
091: * index
092: */
093: public org.exolab.castor.builder.binding.xml.Exclude getExclude(
094: final int index) throws java.lang.IndexOutOfBoundsException {
095: // check bounds for index
096: if (index < 0 || index >= this ._excludeList.size()) {
097: throw new IndexOutOfBoundsException(
098: "getExclude: Index value '" + index
099: + "' not in range [0.."
100: + (this ._excludeList.size() - 1) + "]");
101: }
102:
103: return (org.exolab.castor.builder.binding.xml.Exclude) _excludeList
104: .get(index);
105: }
106:
107: /**
108: * Method getExclude.Returns the contents of the collection in
109: * an Array. <p>Note: Just in case the collection contents
110: * are changing in another thread, we pass a 0-length Array of
111: * the correct type into the API call. This way we <i>know</i>
112: * that the Array returned is of exactly the correct length.
113: *
114: * @return this collection as an Array
115: */
116: public org.exolab.castor.builder.binding.xml.Exclude[] getExclude() {
117: org.exolab.castor.builder.binding.xml.Exclude[] array = new org.exolab.castor.builder.binding.xml.Exclude[0];
118: return (org.exolab.castor.builder.binding.xml.Exclude[]) this ._excludeList
119: .toArray(array);
120: }
121:
122: /**
123: * Method getExcludeCount.
124: *
125: * @return the size of this collection
126: */
127: public int getExcludeCount() {
128: return this ._excludeList.size();
129: }
130:
131: /**
132: * Method isValid.
133: *
134: * @return true if this object is valid according to the schema
135: */
136: public boolean isValid() {
137: try {
138: validate();
139: } catch (org.exolab.castor.xml.ValidationException vex) {
140: return false;
141: }
142: return true;
143: }
144:
145: /**
146: * Method iterateExclude.
147: *
148: * @return an Iterator over all possible elements in this
149: * collection
150: */
151: public java.util.Iterator iterateExclude() {
152: return this ._excludeList.iterator();
153: }
154:
155: /**
156: *
157: *
158: * @param out
159: * @throws org.exolab.castor.xml.MarshalException if object is
160: * null or if any SAXException is thrown during marshaling
161: * @throws org.exolab.castor.xml.ValidationException if this
162: * object is an invalid instance according to the schema
163: */
164: public void marshal(final java.io.Writer out)
165: throws org.exolab.castor.xml.MarshalException,
166: org.exolab.castor.xml.ValidationException {
167: Marshaller.marshal(this , out);
168: }
169:
170: /**
171: *
172: *
173: * @param handler
174: * @throws java.io.IOException if an IOException occurs during
175: * marshaling
176: * @throws org.exolab.castor.xml.ValidationException if this
177: * object is an invalid instance according to the schema
178: * @throws org.exolab.castor.xml.MarshalException if object is
179: * null or if any SAXException is thrown during marshaling
180: */
181: public void marshal(final org.xml.sax.ContentHandler handler)
182: throws java.io.IOException,
183: org.exolab.castor.xml.MarshalException,
184: org.exolab.castor.xml.ValidationException {
185: Marshaller.marshal(this , handler);
186: }
187:
188: /**
189: */
190: public void removeAllExclude() {
191: this ._excludeList.clear();
192: }
193:
194: /**
195: * Method removeExclude.
196: *
197: * @param vExclude
198: * @return true if the object was removed from the collection.
199: */
200: public boolean removeExclude(
201: final org.exolab.castor.builder.binding.xml.Exclude vExclude) {
202: boolean removed = _excludeList.remove(vExclude);
203: return removed;
204: }
205:
206: /**
207: * Method removeExcludeAt.
208: *
209: * @param index
210: * @return the element removed from the collection
211: */
212: public org.exolab.castor.builder.binding.xml.Exclude removeExcludeAt(
213: final int index) {
214: java.lang.Object obj = this ._excludeList.remove(index);
215: return (org.exolab.castor.builder.binding.xml.Exclude) obj;
216: }
217:
218: /**
219: *
220: *
221: * @param index
222: * @param vExclude
223: * @throws java.lang.IndexOutOfBoundsException if the index
224: * given is outside the bounds of the collection
225: */
226: public void setExclude(final int index,
227: final org.exolab.castor.builder.binding.xml.Exclude vExclude)
228: throws java.lang.IndexOutOfBoundsException {
229: // check bounds for index
230: if (index < 0 || index >= this ._excludeList.size()) {
231: throw new IndexOutOfBoundsException(
232: "setExclude: Index value '" + index
233: + "' not in range [0.."
234: + (this ._excludeList.size() - 1) + "]");
235: }
236:
237: this ._excludeList.set(index, vExclude);
238: }
239:
240: /**
241: *
242: *
243: * @param vExcludeArray
244: */
245: public void setExclude(
246: final org.exolab.castor.builder.binding.xml.Exclude[] vExcludeArray) {
247: //-- copy array
248: _excludeList.clear();
249:
250: for (int i = 0; i < vExcludeArray.length; i++) {
251: this ._excludeList.add(vExcludeArray[i]);
252: }
253: }
254:
255: /**
256: * Method unmarshalExcludes.
257: *
258: * @param reader
259: * @throws org.exolab.castor.xml.MarshalException if object is
260: * null or if any SAXException is thrown during marshaling
261: * @throws org.exolab.castor.xml.ValidationException if this
262: * object is an invalid instance according to the schema
263: * @return the unmarshaled
264: * org.exolab.castor.builder.binding.xml.Excludes
265: */
266: public static org.exolab.castor.builder.binding.xml.Excludes unmarshalExcludes(
267: final java.io.Reader reader)
268: throws org.exolab.castor.xml.MarshalException,
269: org.exolab.castor.xml.ValidationException {
270: return (org.exolab.castor.builder.binding.xml.Excludes) Unmarshaller
271: .unmarshal(
272: org.exolab.castor.builder.binding.xml.Excludes.class,
273: reader);
274: }
275:
276: /**
277: *
278: *
279: * @throws org.exolab.castor.xml.ValidationException if this
280: * object is an invalid instance according to the schema
281: */
282: public void validate()
283: throws org.exolab.castor.xml.ValidationException {
284: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
285: validator.validate(this);
286: }
287:
288: }
|