|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.picocontainer.parameters.BasicComponentParameter
public class BasicComponentParameter
A BasicComponentParameter should be used to pass in a particular component as argument to a different component's constructor. This is particularly useful in cases where several components of the same type have been registered, but with a different key. Passing a ComponentParameter as a parameter when registering a component will give PicoContainer a hint about what other component to use in the constructor. This Parameter will never resolve against a collecting type, that is not directly registered in the PicoContainer itself.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.picocontainer.Parameter |
|---|
Parameter.DelegateResolver, Parameter.NotResolved, Parameter.Resolver, Parameter.ValueResolver |
| Field Summary | |
|---|---|
static BasicComponentParameter |
BASIC_DEFAULT
BASIC_DEFAULT is an instance of BasicComponentParameter using the default constructor. |
| Fields inherited from interface org.picocontainer.Parameter |
|---|
DEFAULT, ZERO |
| Constructor Summary | |
|---|---|
BasicComponentParameter()
Expect any parameter of the appropriate type. |
|
BasicComponentParameter(Object componentKey)
Expect a parameter matching a component of a specific key. |
|
| Method Summary | ||
|---|---|---|
void |
accept(PicoVisitor visitor)
Visit the current Parameter. |
|
Parameter.Resolver |
resolve(PicoContainer container,
ComponentAdapter<?> forAdapter,
ComponentAdapter<?> injecteeAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Check whether the given Parameter can be satisfied by the container. |
|
protected
|
resolveAdapter(PicoContainer container,
ComponentAdapter adapter,
Class<T> expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
|
|
void |
verify(PicoContainer container,
ComponentAdapter<?> forAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Verify that the Parameter can satisfy the expected type using the container |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final BasicComponentParameter BASIC_DEFAULT
BASIC_DEFAULT is an instance of BasicComponentParameter using the default constructor.
| Constructor Detail |
|---|
public BasicComponentParameter(Object componentKey)
componentKey - the key of the desired addComponentpublic BasicComponentParameter()
| Method Detail |
|---|
public Parameter.Resolver resolve(PicoContainer container,
ComponentAdapter<?> forAdapter,
ComponentAdapter<?> injecteeAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
resolve in interface Parametercontainer - the container from which dependencies are resolved.forAdapter - the ComponentAdapter that is asking for the instanceexpectedType - the required typeexpectedNameBinding - Expected parameter namebinding - @return true if the component parameter can be resolved.
true if the Parameter can be verified.
PicoCompositionExceptionParameter#isResolvable(PicoContainer, ComponentAdapter, Class, NameBinding ,boolean, Annotation)
public void verify(PicoContainer container,
ComponentAdapter<?> forAdapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Parameter
verify in interface Parametercontainer - the container from which dependencies are resolved.forAdapter - the ComponentAdapter that is asking for the verificationexpectedType - the required typeexpectedNameBinding - Expected parameter namepublic void accept(PicoVisitor visitor)
Parameter.
accept in interface Parametervisitor - the visitor.Parameter.accept(org.picocontainer.PicoVisitor)
protected <T> ComponentAdapter<T> resolveAdapter(PicoContainer container,
ComponentAdapter adapter,
Class<T> expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||