001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
004: * Schema.
005: * $Id$
006: */
007:
008: package com.calipso.reportgenerator.reportdefinitions;
009:
010: //---------------------------------/
011: //- Imported classes and packages -/
012: //---------------------------------/
013:
014: import java.io.IOException;
015: import java.io.Reader;
016: import java.io.Serializable;
017: import java.io.Writer;
018: import java.util.Enumeration;
019: import java.util.Vector;
020: import org.exolab.castor.xml.MarshalException;
021: import org.exolab.castor.xml.Marshaller;
022: import org.exolab.castor.xml.Unmarshaller;
023: import org.exolab.castor.xml.ValidationException;
024: import org.xml.sax.ContentHandler;
025:
026: /**
027: * Class Localization.
028: *
029: * @version $Revision$ $Date$
030: */
031: public class Localization implements java.io.Serializable {
032:
033: //--------------------------/
034: //- Class/Member Variables -/
035: //--------------------------/
036:
037: /**
038: * Field _locale
039: */
040: private java.lang.String _locale;
041:
042: /**
043: * Field _literalsList
044: */
045: private java.util.Vector _literalsList;
046:
047: //----------------/
048: //- Constructors -/
049: //----------------/
050:
051: public Localization() {
052: super ();
053: _literalsList = new Vector();
054: } //-- com.calipso.reportgenerator.reportdefinitions.Localization()
055:
056: //-----------/
057: //- Methods -/
058: //-----------/
059:
060: /**
061: * Method addLiterals
062: *
063: * @param vLiterals
064: */
065: public void addLiterals(
066: com.calipso.reportgenerator.reportdefinitions.Literals vLiterals)
067: throws java.lang.IndexOutOfBoundsException {
068: _literalsList.addElement(vLiterals);
069: } //-- void addLiterals(com.calipso.reportgenerator.reportdefinitions.Literals)
070:
071: /**
072: * Method addLiterals
073: *
074: * @param index
075: * @param vLiterals
076: */
077: public void addLiterals(
078: int index,
079: com.calipso.reportgenerator.reportdefinitions.Literals vLiterals)
080: throws java.lang.IndexOutOfBoundsException {
081: _literalsList.insertElementAt(vLiterals, index);
082: } //-- void addLiterals(int, com.calipso.reportgenerator.reportdefinitions.Literals)
083:
084: /**
085: * Method enumerateLiterals
086: */
087: public java.util.Enumeration enumerateLiterals() {
088: return _literalsList.elements();
089: } //-- java.util.Enumeration enumerateLiterals()
090:
091: /**
092: * Method getLiterals
093: *
094: * @param index
095: */
096: public com.calipso.reportgenerator.reportdefinitions.Literals getLiterals(
097: int index) throws java.lang.IndexOutOfBoundsException {
098: //-- check bounds for index
099: if ((index < 0) || (index > _literalsList.size())) {
100: throw new IndexOutOfBoundsException();
101: }
102:
103: return (com.calipso.reportgenerator.reportdefinitions.Literals) _literalsList
104: .elementAt(index);
105: } //-- com.calipso.reportgenerator.reportdefinitions.Literals getLiterals(int)
106:
107: /**
108: * Method getLiterals
109: */
110: public com.calipso.reportgenerator.reportdefinitions.Literals[] getLiterals() {
111: int size = _literalsList.size();
112: com.calipso.reportgenerator.reportdefinitions.Literals[] mArray = new com.calipso.reportgenerator.reportdefinitions.Literals[size];
113: for (int index = 0; index < size; index++) {
114: mArray[index] = (com.calipso.reportgenerator.reportdefinitions.Literals) _literalsList
115: .elementAt(index);
116: }
117: return mArray;
118: } //-- com.calipso.reportgenerator.reportdefinitions.Literals[] getLiterals()
119:
120: /**
121: * Method getLiteralsCount
122: */
123: public int getLiteralsCount() {
124: return _literalsList.size();
125: } //-- int getLiteralsCount()
126:
127: /**
128: * Method getLocaleReturns the value of field 'locale'.
129: *
130: * @return the value of field 'locale'.
131: */
132: public java.lang.String getLocale() {
133: return this ._locale;
134: } //-- java.lang.String getLocale()
135:
136: /**
137: * Method isValid
138: */
139: public boolean isValid() {
140: try {
141: validate();
142: } catch (org.exolab.castor.xml.ValidationException vex) {
143: return false;
144: }
145: return true;
146: } //-- boolean isValid()
147:
148: /**
149: * Method marshal
150: *
151: * @param out
152: */
153: public void marshal(java.io.Writer out)
154: throws org.exolab.castor.xml.MarshalException,
155: org.exolab.castor.xml.ValidationException {
156:
157: Marshaller.marshal(this , out);
158: } //-- void marshal(java.io.Writer)
159:
160: /**
161: * Method marshal
162: *
163: * @param handler
164: */
165: public void marshal(org.xml.sax.ContentHandler handler)
166: throws java.io.IOException,
167: org.exolab.castor.xml.MarshalException,
168: org.exolab.castor.xml.ValidationException {
169:
170: Marshaller.marshal(this , handler);
171: } //-- void marshal(org.xml.sax.ContentHandler)
172:
173: /**
174: * Method removeAllLiterals
175: */
176: public void removeAllLiterals() {
177: _literalsList.removeAllElements();
178: } //-- void removeAllLiterals()
179:
180: /**
181: * Method removeLiterals
182: *
183: * @param index
184: */
185: public com.calipso.reportgenerator.reportdefinitions.Literals removeLiterals(
186: int index) {
187: java.lang.Object obj = _literalsList.elementAt(index);
188: _literalsList.removeElementAt(index);
189: return (com.calipso.reportgenerator.reportdefinitions.Literals) obj;
190: } //-- com.calipso.reportgenerator.reportdefinitions.Literals removeLiterals(int)
191:
192: /**
193: * Method setLiterals
194: *
195: * @param index
196: * @param vLiterals
197: */
198: public void setLiterals(
199: int index,
200: com.calipso.reportgenerator.reportdefinitions.Literals vLiterals)
201: throws java.lang.IndexOutOfBoundsException {
202: //-- check bounds for index
203: if ((index < 0) || (index > _literalsList.size())) {
204: throw new IndexOutOfBoundsException();
205: }
206: _literalsList.setElementAt(vLiterals, index);
207: } //-- void setLiterals(int, com.calipso.reportgenerator.reportdefinitions.Literals)
208:
209: /**
210: * Method setLiterals
211: *
212: * @param literalsArray
213: */
214: public void setLiterals(
215: com.calipso.reportgenerator.reportdefinitions.Literals[] literalsArray) {
216: //-- copy array
217: _literalsList.removeAllElements();
218: for (int i = 0; i < literalsArray.length; i++) {
219: _literalsList.addElement(literalsArray[i]);
220: }
221: } //-- void setLiterals(com.calipso.reportgenerator.reportdefinitions.Literals)
222:
223: /**
224: * Method setLocaleSets the value of field 'locale'.
225: *
226: * @param locale the value of field 'locale'.
227: */
228: public void setLocale(java.lang.String locale) {
229: this ._locale = locale;
230: } //-- void setLocale(java.lang.String)
231:
232: /**
233: * Method unmarshal
234: *
235: * @param reader
236: */
237: public static com.calipso.reportgenerator.reportdefinitions.Localization unmarshal(
238: java.io.Reader reader)
239: throws org.exolab.castor.xml.MarshalException,
240: org.exolab.castor.xml.ValidationException {
241: return (com.calipso.reportgenerator.reportdefinitions.Localization) Unmarshaller
242: .unmarshal(
243: com.calipso.reportgenerator.reportdefinitions.Localization.class,
244: reader);
245: } //-- com.calipso.reportgenerator.reportdefinitions.Localization unmarshal(java.io.Reader)
246:
247: /**
248: * Method validate
249: */
250: public void validate()
251: throws org.exolab.castor.xml.ValidationException {
252: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
253: validator.validate(this );
254: } //-- void validate()
255:
256: }
|