|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.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.
Field Summary | |
static BasicComponentParameter |
BASIC_DEFAULT
BASIC_DEFAULT is an instance of BasicComponentParameter using the default constructor. |
Constructor Summary | |
BasicComponentParameter()
Expect any paramter 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 . |
boolean |
isResolvable(PicoContainer container,
ComponentAdapter adapter,
Class expectedType)
Check wether the given Parameter can be statisfied by the container. |
Object |
resolveInstance(PicoContainer container,
ComponentAdapter adapter,
Class expectedType)
Retrieve the object from the Parameter that statisfies the expected type. |
void |
verify(PicoContainer container,
ComponentAdapter adapter,
Class expectedType)
Verify that the Parameter can statisfied 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 componentpublic BasicComponentParameter()
Method Detail |
public boolean isResolvable(PicoContainer container, ComponentAdapter adapter, Class expectedType)
isResolvable
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the container that should be searchedexpectedType
- the required type
true
if the Parameter can be verified.Parameter.isResolvable(org.picocontainer.PicoContainer,
org.picocontainer.ComponentAdapter, java.lang.Class)
public Object resolveInstance(PicoContainer container, ComponentAdapter adapter, Class expectedType) throws PicoInstantiationException
Parameter
resolveInstance
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter that is asking for the instanceexpectedType
- the type that the returned instance needs to match.
null
if no suitable instance can be found.
PicoInstantiationException
public void verify(PicoContainer container, ComponentAdapter adapter, Class expectedType) throws PicoIntrospectionException
Parameter
verify
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the container that should be searchedexpectedType
- the required type
PicoIntrospectionException
- if parameter and its dependencies cannot be resolvedpublic void accept(PicoVisitor visitor)
Parameter
.
accept
in interface Parameter
visitor
- the visitor.Parameter.accept(org.picocontainer.PicoVisitor)
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |