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