01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: *****************************************************************************/package org.picocontainer;
08:
09: /**
10: * Interface realizing a visitor pattern for {@link PicoContainer} as described in the GoF.
11: * The visitor should visit the container, its children, all registered {@link ComponentAdapter}
12: * instances and all instantiated components.
13: *
14: * @author Aslak Hellesøy
15: * @author Jörg Schaible
16: */
17: public interface PicoVisitor {
18: /**
19: * Entry point for the PicoVisitor traversal. The given node is the first object, that is
20: * asked for acceptance. Only objects of type {@link PicoContainer}, {@link ComponentAdapter},
21: * or {@link Parameter} are valid.
22: *
23: * @param node the start node of the traversal.
24: * @return a visitor-specific value.
25: * @throws IllegalArgumentException in case of an argument of invalid type.
26: */
27: Object traverse(Object node);
28:
29: /**
30: * Visit a {@link PicoContainer} that has to accept the visitor.
31: *
32: * @param pico the visited container.
33: */
34:
35: void visitContainer(PicoContainer pico);
36:
37: /**
38: * Visit a {@link ComponentAdapter} that has to accept the visitor.
39: *
40: * @param componentAdapter the visited ComponentAdapter.
41: */
42:
43: void visitComponentAdapter(ComponentAdapter componentAdapter);
44:
45: /**
46: * Visit a {@link Parameter} that has to accept the visitor.
47: *
48: * @param parameter the visited Parameter.
49: */
50: void visitParameter(Parameter parameter);
51: }
|