public class BasicComponentParameter extends java.lang.Object implements Parameter, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static BasicComponentParameter |
BASIC_DEFAULT
BASIC_DEFAULT is an instance of BasicComponentParameter using the default constructor. |
private java.lang.Object |
componentKey |
Constructor and Description |
---|
BasicComponentParameter()
Expect any paramter of the appropriate type.
|
BasicComponentParameter(java.lang.Object componentKey)
Expect a parameter matching a component of a specific key.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PicoVisitor visitor)
Visit the current
Parameter . |
private ComponentAdapter |
getTargetAdapter(PicoContainer container,
java.lang.Class expectedType,
ComponentAdapter excludeAdapter) |
boolean |
isResolvable(PicoContainer container,
ComponentAdapter adapter,
java.lang.Class expectedType)
Check wether the given Parameter can be statisfied by the container.
|
private ComponentAdapter |
resolveAdapter(PicoContainer container,
ComponentAdapter adapter,
java.lang.Class expectedType) |
java.lang.Object |
resolveInstance(PicoContainer container,
ComponentAdapter adapter,
java.lang.Class expectedType)
Retrieve the object from the Parameter that statisfies the expected type.
|
void |
verify(PicoContainer container,
ComponentAdapter adapter,
java.lang.Class expectedType)
Verify that the Parameter can statisfied the expected type using the container
|
public static final BasicComponentParameter BASIC_DEFAULT
BASIC_DEFAULT
is an instance of BasicComponentParameter using the default constructor.private java.lang.Object componentKey
public BasicComponentParameter(java.lang.Object componentKey)
componentKey
- the key of the desired componentpublic BasicComponentParameter()
public boolean isResolvable(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType)
isResolvable
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the instanceexpectedType
- the required typetrue
if the Parameter can be verified.PicoInitializationException
Parameter.isResolvable(org.picocontainer.PicoContainer,
org.picocontainer.ComponentAdapter, java.lang.Class)
public java.lang.Object resolveInstance(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType)
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.public void verify(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType)
Parameter
verify
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the verificationexpectedType
- the required typepublic void accept(PicoVisitor visitor)
Parameter
.accept
in interface Parameter
visitor
- the visitor.Parameter.accept(org.picocontainer.PicoVisitor)
private ComponentAdapter resolveAdapter(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType)
private ComponentAdapter getTargetAdapter(PicoContainer container, java.lang.Class expectedType, ComponentAdapter excludeAdapter)