001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 0.9.5.2</a>, using an XML
004: * Schema.
005: * $Id: PreferenceType.java 6385 2007-10-25 14:02:26Z wehrens $
006: */
007:
008: package org.gridsphere.portletcontainer.impl.descriptor;
009:
010: //---------------------------------/
011: //- Imported classes and packages -/
012: //---------------------------------/
013:
014: import org.exolab.castor.xml.Marshaller;
015: import org.exolab.castor.xml.Unmarshaller;
016: import org.gridsphere.portletcontainer.impl.descriptor.types.ReadOnlyType;
017:
018: import java.util.ArrayList;
019:
020: /**
021: * Persistent preference values that may be used for customization
022: * and personalization by the portlet.
023: * Used in: portlet-preferences
024: *
025: * @version $Revision: 3298 $ $Date: 2004-06-29 07:19:44 -0700 (Tue, 29 Jun 2004) $
026: */
027: public class PreferenceType implements java.io.Serializable {
028:
029: //--------------------------/
030: //- Class/Member Variables -/
031: //--------------------------/
032:
033: /**
034: * Field _id
035: */
036: private java.lang.String _id;
037:
038: /**
039: * Field _name
040: */
041: private org.gridsphere.portletcontainer.impl.descriptor.Name _name;
042:
043: /**
044: * Field _valueList
045: */
046: private java.util.ArrayList _valueList;
047:
048: /**
049: * Field _readOnly
050: */
051: private org.gridsphere.portletcontainer.impl.descriptor.types.ReadOnlyType _readOnly;
052:
053: //----------------/
054: //- Constructors -/
055: //----------------/
056:
057: public PreferenceType() {
058: super ();
059: _readOnly = new ReadOnlyType();
060: _valueList = new ArrayList();
061: } //-- org.gridsphere.portletcontainer.jsr.descriptor.PreferenceType()
062:
063: //-----------/
064: //- Methods -/
065: //-----------/
066:
067: /**
068: * Method addValue
069: *
070: * @param vValue
071: */
072: public void addValue(
073: org.gridsphere.portletcontainer.impl.descriptor.Value vValue)
074: throws java.lang.IndexOutOfBoundsException {
075: _valueList.add(vValue);
076: } //-- void addValue(org.gridsphere.portletcontainer.jsr.descriptor.Value)
077:
078: /**
079: * Method addValue
080: *
081: * @param index
082: * @param vValue
083: */
084: public void addValue(int index,
085: org.gridsphere.portletcontainer.impl.descriptor.Value vValue)
086: throws java.lang.IndexOutOfBoundsException {
087: _valueList.add(index, vValue);
088: } //-- void addValue(int, org.gridsphere.portletcontainer.jsr.descriptor.Value)
089:
090: /**
091: * Method clearValue
092: */
093: public void clearValue() {
094: _valueList.clear();
095: } //-- void clearValue()
096:
097: /**
098: * Method enumerateValue
099: */
100: public java.util.Enumeration enumerateValue() {
101: return new org.exolab.castor.util.IteratorEnumeration(
102: _valueList.iterator());
103: } //-- java.util.Enumeration enumerateValue()
104:
105: /**
106: * Returns the value of field 'id'.
107: *
108: * @return the value of field 'id'.
109: */
110: public java.lang.String getId() {
111: return this ._id;
112: } //-- java.lang.String getId()
113:
114: /**
115: * Returns the value of field 'name'.
116: *
117: * @return the value of field 'name'.
118: */
119: public org.gridsphere.portletcontainer.impl.descriptor.Name getName() {
120: return this ._name;
121: } //-- org.gridsphere.portletcontainer.jsr.descriptor.Name getName()
122:
123: /**
124: * Returns the value of field 'readOnly'.
125: *
126: * @return the value of field 'readOnly'.
127: */
128: public org.gridsphere.portletcontainer.impl.descriptor.types.ReadOnlyType getReadOnly() {
129: return this ._readOnly;
130: } //-- org.gridsphere.portletcontainer.jsr.descriptor.types.ReadOnlyType getReadOnly()
131:
132: /**
133: * Method getValue
134: *
135: * @param index
136: */
137: public org.gridsphere.portletcontainer.impl.descriptor.Value getValue(
138: int index) throws java.lang.IndexOutOfBoundsException {
139: //-- check bounds for index
140: if ((index < 0) || (index > _valueList.size())) {
141: throw new IndexOutOfBoundsException();
142: }
143:
144: return (org.gridsphere.portletcontainer.impl.descriptor.Value) _valueList
145: .get(index);
146: } //-- org.gridsphere.portletcontainer.jsr.descriptor.Value getValue(int)
147:
148: /**
149: * Method getValue
150: */
151: public org.gridsphere.portletcontainer.impl.descriptor.Value[] getValue() {
152: int size = _valueList.size();
153: org.gridsphere.portletcontainer.impl.descriptor.Value[] mArray = new org.gridsphere.portletcontainer.impl.descriptor.Value[size];
154: for (int index = 0; index < size; index++) {
155: mArray[index] = (org.gridsphere.portletcontainer.impl.descriptor.Value) _valueList
156: .get(index);
157: }
158: return mArray;
159: } //-- org.gridsphere.portletcontainer.jsr.descriptor.Value[] getValue()
160:
161: /**
162: * Method getValueCount
163: */
164: public int getValueCount() {
165: return _valueList.size();
166: } //-- int getValueCount()
167:
168: /**
169: * Method isValid
170: */
171: public boolean isValid() {
172: try {
173: validate();
174: } catch (org.exolab.castor.xml.ValidationException vex) {
175: return false;
176: }
177: return true;
178: } //-- boolean isValid()
179:
180: /**
181: * Method marshal
182: *
183: * @param out
184: */
185: public void marshal(java.io.Writer out)
186: throws org.exolab.castor.xml.MarshalException,
187: org.exolab.castor.xml.ValidationException {
188:
189: Marshaller.marshal(this , out);
190: } //-- void marshal(java.io.Writer)
191:
192: /**
193: * Method marshal
194: *
195: * @param handler
196: */
197: public void marshal(org.xml.sax.ContentHandler handler)
198: throws java.io.IOException,
199: org.exolab.castor.xml.MarshalException,
200: org.exolab.castor.xml.ValidationException {
201:
202: Marshaller.marshal(this , handler);
203: } //-- void marshal(org.xml.sax.ContentHandler)
204:
205: /**
206: * Method removeValue
207: *
208: * @param vValue
209: */
210: public boolean removeValue(
211: org.gridsphere.portletcontainer.impl.descriptor.Value vValue) {
212: boolean removed = _valueList.remove(vValue);
213: return removed;
214: } //-- boolean removeValue(org.gridsphere.portletcontainer.jsr.descriptor.Value)
215:
216: /**
217: * Sets the value of field 'id'.
218: *
219: * @param id the value of field 'id'.
220: */
221: public void setId(java.lang.String id) {
222: this ._id = id;
223: } //-- void setId(java.lang.String)
224:
225: /**
226: * Sets the value of field 'name'.
227: *
228: * @param name the value of field 'name'.
229: */
230: public void setName(
231: org.gridsphere.portletcontainer.impl.descriptor.Name name) {
232: this ._name = name;
233: } //-- void setName(org.gridsphere.portletcontainer.jsr.descriptor.Name)
234:
235: /**
236: * Sets the value of field 'readOnly'.
237: *
238: * @param readOnly the value of field 'readOnly'.
239: */
240: public void setReadOnly(
241: org.gridsphere.portletcontainer.impl.descriptor.types.ReadOnlyType readOnly) {
242: this ._readOnly = readOnly;
243: } //-- void setReadOnly(org.gridsphere.portletcontainer.jsr.descriptor.types.ReadOnlyType)
244:
245: /**
246: * Method setValue
247: *
248: * @param index
249: * @param vValue
250: */
251: public void setValue(int index,
252: org.gridsphere.portletcontainer.impl.descriptor.Value vValue)
253: throws java.lang.IndexOutOfBoundsException {
254: //-- check bounds for index
255: if ((index < 0) || (index > _valueList.size())) {
256: throw new IndexOutOfBoundsException();
257: }
258: _valueList.set(index, vValue);
259: } //-- void setValue(int, org.gridsphere.portletcontainer.jsr.descriptor.Value)
260:
261: /**
262: * Method setValue
263: *
264: * @param valueArray
265: */
266: public void setValue(
267: org.gridsphere.portletcontainer.impl.descriptor.Value[] valueArray) {
268: //-- copy array
269: _valueList.clear();
270: for (int i = 0; i < valueArray.length; i++) {
271: _valueList.add(valueArray[i]);
272: }
273: } //-- void setValue(org.gridsphere.portletcontainer.jsr.descriptor.Value)
274:
275: /**
276: * Method unmarshal
277: *
278: * @param reader
279: */
280: public static java.lang.Object unmarshal(java.io.Reader reader)
281: throws org.exolab.castor.xml.MarshalException,
282: org.exolab.castor.xml.ValidationException {
283: return (org.gridsphere.portletcontainer.impl.descriptor.PreferenceType) Unmarshaller
284: .unmarshal(
285: org.gridsphere.portletcontainer.impl.descriptor.PreferenceType.class,
286: reader);
287: } //-- java.lang.Object unmarshal(java.io.Reader)
288:
289: /**
290: * Method validate
291: */
292: public void validate()
293: throws org.exolab.castor.xml.ValidationException {
294: org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
295: validator.validate(this );
296: } //-- void validate()
297:
298: }
|