01: package org.jicengine.element;
02:
03: import org.jicengine.operation.Context;
04: import org.jicengine.expression.*;
05:
06: /**
07: * <p>
08: * VariableElements are elements that both have a value and let the clients/users
09: * decide what to do with the value. The client/user of a VariableElement is typically
10: * the parent element.
11: * </p>
12: * <p>
13: * The latter aspect is an important one. A VariableElement doesn't actually know
14: * what to do with the value, it can only create the value. It is the responsibility
15: * of the client/user to use the value for something.
16: * </p>
17: * <p>
18: * VariableElements are usually used for producing parameters of various operations,
19: * like the constructor and action operation of an element.
20: * </p>
21: * <p>
22: * Copyright (C) 2004 Timo Laitinen
23: * </p>
24: *
25: * @author Timo Laitinen
26: * @created 2004-09-20
27: * @since JICE-0.10
28: */
29:
30: public interface VariableElement extends Element {
31:
32: /**
33: * <p>
34: * Creates and returns the value of this element.
35: * </p>
36: * <p>
37: * The client/user of this element will call this method. currently, the method
38: * is called only once. No caching of the result is needed. However, the
39: * object should be able to be executed multiple times.
40: * </p>
41: * <p>
42: * in general, the creation of the value consists of the following steps:
43: * </p>
44: *
45: * <ol>
46: * <li> the instance of the element is created first (with parameters)</li>
47: * <li> if the element has other ActionElements as children, they are executed next </li>
48: * <li> the instance is returned. </li>
49: * </ol>
50: *
51: * @param globalContext a Context where the instances marked with the 'id'-attribute
52: * are put.
53: *
54: * @param parentInstance the instance of the parent element. NOTE: null-value means
55: * that the value of the parent is not available (not yet
56: * or never), not that the instance of the parent is null!
57: *
58: * @return the value of the element. the operation can return null!
59: * (although that is not currently supported by other parts ozf the framework)
60: * @throws ElementException if any part of the execution of the action fails.
61: */
62: public Object getValue(Context globalContext, Object parentInstance)
63: throws ElementException;
64:
65: public Class getInstanceClass();
66: }
|