public interface Parameter
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.| Modifier and Type | Interface and Description |
|---|---|
static class |
Parameter.DelegateResolver
Delegate to another reolver
|
static class |
Parameter.NotResolved
The Parameter cannot (ever) be resolved
|
static interface |
Parameter.Resolver
Resolver is used transitarily during resolving of Parameters.
|
static class |
Parameter.ValueResolver
A fixed value wrapped as a Resolver
|
| Modifier and Type | Field and Description |
|---|---|
static Parameter[] |
DEFAULT |
static Parameter[] |
ZERO
Zero parameter is used when you wish a component to be instantiated with its default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this Parameter.
|
boolean |
isResolvable(PicoContainer container,
ComponentAdapter<?> forAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Deprecated.
|
Parameter.Resolver |
resolve(PicoContainer container,
ComponentAdapter<?> forAdapter,
ComponentAdapter<?> injecteeAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Check if the Parameter can satisfy the expected type using the container.
|
Object |
resolveInstance(PicoContainer container,
ComponentAdapter<?> forAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Deprecated.
|
void |
verify(PicoContainer container,
ComponentAdapter<?> adapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Verify that the Parameter can satisfy the expected type using the container
|
static final Parameter[] ZERO
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.
Parameter.Resolver resolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
container - the container from which dependencies are resolved.forAdapter - the ComponentAdapter that 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 - @return true if the component parameter can be resolved.void verify(PicoContainer container, ComponentAdapter<?> adapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
container - the container from which dependencies are resolved.adapter - the ComponentAdapter that is asking for the verificationexpectedType - the required typeexpectedNameBinding - Expected parameter nameuseNames - binding - PicoCompositionException - if parameter and its dependencies cannot be resolvedvoid accept(PicoVisitor visitor)
ComponentAdapter, that
cascades the visitor also down to all its Parameters.visitor - the visitor.@Deprecated Object resolveInstance(PicoContainer container, ComponentAdapter<?> forAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
@Deprecated boolean isResolvable(PicoContainer container, ComponentAdapter<?> forAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
Copyright © 2003-2014 Codehaus. All Rights Reserved.