001 /*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file. *
007 *****************************************************************************/
008 package org.picocontainer;
009
010 /**
011 * Interface realizing a visitor pattern for {@link PicoContainer} as described in the GoF.
012 * The visitor should visit the container, its children, all registered {@link ComponentAdapter}
013 * instances and all instantiated components.
014 *
015 * @author Aslak Hellesøy
016 * @author Jörg Schaible
017 * @version $Revision: 1753 $
018 * @since 1.1
019 */
020 public interface PicoVisitor {
021 /**
022 * Entry point for the PicoVisitor traversal. The given node is the first object, that is
023 * asked for acceptance. Only objects of type {@link PicoContainer}, {@link ComponentAdapter},
024 * or {@link Parameter} are valid.
025 *
026 * @param node the start node of the traversal.
027 * @return a visitor-specific value.
028 * @throws IllegalArgumentException in case of an argument of invalid type.
029 * @since 1.1
030 */
031 Object traverse(Object node);
032
033 /**
034 * Visit a {@link PicoContainer} that has to accept the visitor.
035 *
036 * @param pico the visited container.
037 * @since 1.1
038 */
039
040 void visitContainer(PicoContainer pico);
041 /**
042 * Visit a {@link ComponentAdapter} that has to accept the visitor.
043 *
044 * @param componentAdapter the visited ComponentAdapter.
045 * @since 1.1
046 */
047
048 void visitComponentAdapter(ComponentAdapter componentAdapter);
049 /**
050 * Visit a {@link Parameter} that has to accept the visitor.
051 *
052 * @param parameter the visited Parameter.
053 * @since 1.1
054 */
055 void visitParameter(Parameter parameter);
056 }