Clover coverage report - PicoContainer - 1.1
Coverage timestamp: Thu Nov 4 2004 11:55:45 CST
file stats: LOC: 73   Methods: 0
NCLOC: 8   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ComponentAdapter.java - - - -
coverage
 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   
  * A component adapter is responsible for providing a specific component instance. An instance of an implementation of
 12   
  * this interface is used inside a {@link PicoContainer} for every registered component or instance.  Each
 13   
  * <code>ComponentAdapter</code> instance has to have a key which is unique within that container. The key itself is
 14   
  * either a class type (normally an interface) or an identifier.
 15   
  *
 16   
  * @author Jon Tirs&eacute;n
 17   
  * @author Paul Hammant
 18   
  * @author Aslak Helles&oslash;y
 19   
  * @version $Revision: 1.20 $
 20   
  * @see MutablePicoContainer an extension of the PicoContainer interface which allows you to modify the contents of the
 21   
  *      container.
 22   
  * @since 1.0
 23   
  */
 24   
 public interface ComponentAdapter {
 25   
     /**
 26   
      * Retrieve the key associated with the component.
 27   
      * 
 28   
      * @return the component's key. Should either be a class type (normally an interface) or an identifier that is
 29   
      *         unique (within the scope of the current PicoContainer).
 30   
      */
 31   
     Object getComponentKey();
 32   
 
 33   
     /**
 34   
      * Retrieve the class of the component.
 35   
      * 
 36   
      * @return the component's implementation class. Should normally be a concrete class (ie, a class that can be
 37   
      *         instantiated).
 38   
      */
 39   
     Class getComponentImplementation();
 40   
 
 41   
     /**
 42   
      * Retrieve the component instance. This method will usually create a new instance each time it is called, but that
 43   
      * is not required. For example, {@link org.picocontainer.defaults.CachingComponentAdapter} will always return the
 44   
      * same instance.
 45   
      * 
 46   
      * @param container the {@link PicoContainer}, that is used to resolve any possible dependencies of the instance.
 47   
      * @return the component instance.
 48   
      * @throws PicoInitializationException if the component could not be instantiated.
 49   
      * @throws PicoIntrospectionException  if the component has dependencies which could not be resolved, or
 50   
      *                                     instantiation of the component lead to an ambigous situation within the
 51   
      *                                     container.
 52   
      */
 53   
     Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException;
 54   
 
 55   
     /**
 56   
      * Verify that all dependencies for this adapter can be satisifed. Normally, the adapter should verify this by
 57   
      * checking that the associated PicoContainer contains all the needed dependnecies.
 58   
      *
 59   
      * @param container the {@link PicoContainer}, that is used to resolve any possible dependencies of the instance.
 60   
      * @throws PicoIntrospectionException if one or more dependencies cannot be resolved.
 61   
      */
 62   
     void verify(PicoContainer container) throws PicoIntrospectionException;
 63   
 
 64   
     /**
 65   
      * Accepts a visitor for this ComponentAdapter. The method is normally called by visiting a {@link PicoContainer}, that 
 66   
      * cascades the visitor also down to all its ComponentAdapter instances.
 67   
      * 
 68   
      * @param visitor the visitor.
 69   
      * @since 1.1
 70   
      */
 71   
     void accept(PicoVisitor visitor);
 72   
 }
 73