1 package xdoclet.beans;
2
3 import java.beans.beancontext.BeanContextSupport;
4 import java.util.Collection;
5 import java.util.Collections;
6
7 /***
8 * A BeanContext that is aware of its parent. It is also capable of providing
9 * information of what sub elements it can have.
10 *
11 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a>
12 * @version $Revision: 1.3 $
13 */
14 public class BeanContextSupportEx extends BeanContextSupport {
15 private BeanContextSupportEx _parent;
16 private Collection _invocations = null;
17
18 public boolean add(Object o) {
19 if (o instanceof BeanContextSupportEx) {
20 BeanContextSupportEx child = (BeanContextSupportEx) o;
21
22 child.setParent(this);
23 }
24
25 return super.add(o);
26 }
27
28 protected void setParent(BeanContextSupportEx parent) {
29 _parent = parent;
30 }
31
32 public BeanContextSupportEx getParent() {
33 return _parent;
34 }
35
36 /***
37 * Creates a Collection of {@link xdoclet.beans.Invocation}. These serve
38 * as dynamic factories for creation of sub elements. The default
39 * implementation returns an empty Collection. Should be overridden by
40 * subclasses that accept sub elements.
41 *
42 * @return a Collection of {@link xdoclet.beans.Invocation}
43 */
44 protected Collection createInvocations() {
45 return Collections.EMPTY_LIST;
46 }
47
48 public final Collection getInvocations() {
49 if( _invocations == null ) {
50 _invocations = createInvocations();
51 }
52 return _invocations;
53 }
54 }
This page was automatically generated by Maven