01: /*
02: * Created on Dec 18, 2003
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.xssl.collection;
08:
09: import java.util.ArrayList;
10: import java.util.HashMap;
11:
12: import org.xdev.base.xssl.XSSLAction;
13: import org.xdev.base.xssl.XSSLActionIterator;
14: import org.xdev.base.xssl.XSSLReturn;
15:
16: /**
17: * @author AYegorov
18: *
19: * To change the template for this generated type comment go to
20: * Window>Preferences>Java>Code Generation>Code and Comments
21: */
22: public class ArrayCollection extends XSSLActionIterator {
23: public static final String ARRAY_INDEX = "index";
24:
25: private Object returnValue = null;
26:
27: /**
28: * @param id
29: */
30: public ArrayCollection(String id) {
31: super (id);
32: // XXX Auto-generated constructor stub
33: }
34:
35: /**
36: * @param id
37: * @param properties
38: */
39: public ArrayCollection(String id, HashMap properties) {
40: super (id, properties);
41: // XXX Auto-generated constructor stub
42: }
43:
44: /* (non-Javadoc)
45: * @see org.xdev.base.xssl.XSSLActionIterator#invoke(org.xdev.base.xssl.XSSLAction)
46: */
47: protected void invoke(XSSLAction component) throws Exception {
48: if (this .returnValue instanceof ArrayList
49: && component instanceof XSSLReturn) {
50: ((ArrayList) this .returnValue).add(((XSSLReturn) component)
51: .getObjectValue());
52: }
53: }
54:
55: /* (non-Javadoc)
56: * @see org.xdev.base.xssl.XSSLAction#set()
57: */
58: protected void set() throws Exception {
59: ArrayList obj = (ArrayList) this .getEvaluatedReference();
60:
61: if (obj == null) {
62: obj = new ArrayList();
63: this.setReference(this.getReferenceId(), obj);
64: }
65:
66: if (this.hasProperty(ArrayCollection.ARRAY_INDEX)) {
67: this.returnValue = obj.get(this
68: .getIntegerProperty(ArrayCollection.ARRAY_INDEX));
69: } else {
70: this.returnValue = obj;
71: }
72: }
73: }
|