Package org.picocontainer
Interface Parameter
-
- All Known Implementing Classes:
AbstractParameter,BasicComponentParameter,CollectionComponentParameter,ComponentParameter,ConstantParameter,DefaultConstructorParameter,NullParameter
public interface ParameterThis 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 interface which allows passing in of an array of .,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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classParameter.DelegateResolverDelegate to another reolverstatic classParameter.NotResolvedThe Parameter cannot (ever) be resolvedstatic interfaceParameter.ResolverResolver is used transitarily during resolving of Parameters.static classParameter.ValueResolverA fixed value wrapped as a Resolver
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaccept(PicoVisitor visitor)Accepts a visitor for this Parameter.booleanisResolvable(PicoContainer container, ComponentAdapter<?> forAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Deprecated.Parameter.Resolverresolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Check if the Parameter can satisfy the expected type using the container.java.lang.ObjectresolveInstance(PicoContainer container, ComponentAdapter<?> forAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Deprecated.voidverify(PicoContainer container, ComponentAdapter<?> adapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Verify that the Parameter can satisfy the expected type using the container
-
-
-
Field Detail
-
ZERO
static final Parameter[] ZERO
Zero parameter is used when you wish a component to be instantiated with its default constructor. Ex:MutablePicoContainer mpc = new PicoBuilder().build(); mpc.addComponent(Map.class, HashMap.class, Parameter.ZERO); mpc.addComponent(List.class, ArrayList.class, Parameter.ZERO);By specifying the default constructor in this example code, you allow PicoContainer to recognize that HashMap(Collection) should not be used and avoid a CircularDependencyException.
-
DEFAULT
static final Parameter[] DEFAULT
-
-
Method Detail
-
resolve
Parameter.Resolver resolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)
Check if the Parameter can satisfy the expected type using the container.- Parameters:
container- the container from which dependencies are resolved.forAdapter- theComponentAdapterthat is asking for the instanceinjecteeAdapter- the adapter to be injected into (null for N/A)expectedType- the required typeexpectedNameBinding- Expected parameter nameuseNames- should use parameter names for disambiguationbinding-- Returns:
trueif the component parameter can be resolved.- Since:
- 2.8.1
-
verify
void verify(PicoContainer container, ComponentAdapter<?> adapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)
Verify that the Parameter can satisfy the expected type using the container- Parameters:
container- the container from which dependencies are resolved.adapter- theComponentAdapterthat is asking for the verificationexpectedType- the required typeexpectedNameBinding- Expected parameter nameuseNames-binding-- 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 aComponentAdapter, that cascades the visitor also down to all its Parameters.- Parameters:
visitor- the visitor.
-
resolveInstance
@Deprecated java.lang.Object resolveInstance(PicoContainer container, ComponentAdapter<?> forAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)
Deprecated.
-
isResolvable
@Deprecated boolean isResolvable(PicoContainer container, ComponentAdapter<?> forAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)
Deprecated.
-
-