org.picocontainer
Interface Parameter

All Known Implementing Classes:
BasicComponentParameter, CollectionComponentParameter, ComponentParameter, ConstantParameter

public interface Parameter

This class provides control over the arguments that will be passed to a constructor. It can be used for finer control over what arguments are passed to a particular constructor.

Author:
Jon Tirsén, Aslak Hellesøy, Thomas Heller
See Also:
a method on the {@link MutablePicoContainer} interface which allows passing in of an array of {@linkplain Parameter Parameters}., an implementation of this interface that allows you to specify the key used for resolving the parameter., an implementation of this interface that allows you to specify a constant that will be used for resolving the parameter.

Field Summary
static Parameter[] DEFAULT
           
static Parameter[] ZERO
           
 
Method Summary
 void accept(PicoVisitor visitor)
          Accepts a visitor for this Parameter.
 boolean isResolvable(PicoContainer container, ComponentAdapter adapter, Class expectedType, ParameterName expectedParameterName)
          Check if the Parameter can statisfy the expected type using the container.
 Object resolveInstance(PicoContainer container, ComponentAdapter adapter, Class expectedType, ParameterName expectedParameterName)
          Retrieve the object from the Parameter that statisfies the expected type.
 void verify(PicoContainer container, ComponentAdapter adapter, Class expectedType, ParameterName expectedParameterName)
          Verify that the Parameter can statisfied the expected type using the container
 

Field Detail

ZERO

static final Parameter[] ZERO

DEFAULT

static final Parameter[] DEFAULT
Method Detail

resolveInstance

Object resolveInstance(PicoContainer container,
                       ComponentAdapter adapter,
                       Class expectedType,
                       ParameterName expectedParameterName)
Retrieve the object from the Parameter that statisfies the expected type.

Parameters:
container - the container from which dependencies are resolved.
adapter - the ComponentAdapter that is asking for the instance
expectedType - the type that the returned instance needs to match.
expectedParameterName - Expected parameter name
Returns:
the instance or null if no suitable instance can be found.
Throws:
PicoCompositionException - if a referenced component could not be instantiated.

isResolvable

boolean isResolvable(PicoContainer container,
                     ComponentAdapter adapter,
                     Class expectedType,
                     ParameterName expectedParameterName)
Check if the Parameter can statisfy the expected type using the container.

Parameters:
container - the container from which dependencies are resolved.
adapter - the ComponentAdapter that is asking for the instance
expectedType - the required type
expectedParameterName - Expected parameter name
Returns:
true if the component parameter can be resolved.

verify

void verify(PicoContainer container,
            ComponentAdapter adapter,
            Class expectedType,
            ParameterName expectedParameterName)
Verify that the Parameter can statisfied the expected type using the container

Parameters:
container - the container from which dependencies are resolved.
adapter - the ComponentAdapter that is asking for the verification
expectedType - the required type
expectedParameterName - Expected parameter name
Throws:
PicoCompositionException - if parameter and its dependencies cannot be resolved

accept

void accept(PicoVisitor visitor)
Accepts a visitor for this Parameter. The method is normally called by visiting a ComponentAdapter, that cascades the visitor also down to all its Parameters.

Parameters:
visitor - the visitor.


Copyright © 2003-2007 Codehaus. All Rights Reserved.