Clover coverage report - PicoContainer - 1.0-RC-1
Coverage timestamp: Tue May 18 2004 16:19:33 EDT
file stats: LOC: 79   Methods: 0
NCLOC: 9   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   
  * @see MutablePicoContainer an extension of the PicoContainer interface which allows you to modify the contents of the
 17   
  *      container.
 18   
 
 19   
  * @author Jon Tirs&eacute;n
 20   
  * @author Paul Hammant
 21   
  * @author Aslak Helles&oslash;y
 22   
  * @version $Revision: 1.15 $
 23   
  * @since 1.0
 24   
  */
 25   
 public interface ComponentAdapter {
 26   
     /**
 27   
      * Retrieve the key associated with the component.
 28   
      * 
 29   
      * @return the component's key. Should either be a class type (normally an interface) or an identifier that is
 30   
      *         unique (within the scope of the current PicoContainer).
 31   
      */
 32   
     Object getComponentKey();
 33   
 
 34   
     /**
 35   
      * Retrieve the class of the component.
 36   
      * 
 37   
      * @return the component's implementation class. Should normally be a concrete class (ie, a class that can be
 38   
      *         instantiated).
 39   
      */
 40   
     Class getComponentImplementation();
 41   
 
 42   
     /**
 43   
      * Retrieve the component instance. This method will usually create a new instance each time it is called, but that
 44   
      * is not required. For example, {@link org.picocontainer.defaults.CachingComponentAdapter} will always return the
 45   
      * same instance.
 46   
      * 
 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() throws PicoInitializationException, PicoIntrospectionException;
 54   
 
 55   
     /**
 56   
      * Retrieve the container in which the component is registered.
 57   
      * 
 58   
      * @return the container in which the component is registered.
 59   
      */
 60   
     PicoContainer getContainer();
 61   
 
 62   
     /**
 63   
      * Set the container in which this adapter is registered. This method will be called once by the container when the
 64   
      * adapter is registered in that container. It should usually not be called directly.
 65   
      * 
 66   
      * @param picoContainer the container in which this adapter is registered.
 67   
      */
 68   
     void setContainer(PicoContainer picoContainer);
 69   
 
 70   
     /**
 71   
      * Verify that all dependencies for this adapter can be satisifed. Normally, the adapter should verify this by
 72   
      * checking that the associated PicoContainer contains all the needed dependnecies.
 73   
      * 
 74   
      * @throws PicoVerificationException
 75   
      *          if one or more dependencies cannot be resolved.
 76   
      */
 77   
     void verify() throws PicoVerificationException;
 78   
 }
 79