public class ConstantParameter extends java.lang.Object implements Parameter, java.io.Serializable
String
s,Integer
s or any other object that is not registered in
the container.Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
value |
Constructor and Description |
---|
ConstantParameter(java.lang.Object value) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PicoVisitor visitor)
Visit the current
Parameter . |
private boolean |
checkPrimitive(java.lang.Class expectedType) |
boolean |
isResolvable(PicoContainer container,
ComponentAdapter adapter,
java.lang.Class expectedType)
Check if the Parameter can statisfy the expected type using the container.
|
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 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 boolean isResolvable(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType)
Parameter
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 component parameter can be resolved.public void verify(PicoContainer container, ComponentAdapter adapter, java.lang.Class expectedType) throws PicoException
verify
in interface Parameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the verificationexpectedType
- the required typePicoIntrospectionException
- if parameter and its dependencies cannot be resolvedPicoException
Parameter.verify(org.picocontainer.PicoContainer,
org.picocontainer.ComponentAdapter, java.lang.Class)
public void accept(PicoVisitor visitor)
Parameter
.accept
in interface Parameter
visitor
- the visitor.Parameter.accept(org.picocontainer.PicoVisitor)
private boolean checkPrimitive(java.lang.Class expectedType)