Package org.picocontainer.parameters
Class ConstantParameter
- java.lang.Object
-
- org.picocontainer.parameters.AbstractParameter
-
- org.picocontainer.parameters.ConstantParameter
-
- All Implemented Interfaces:
java.io.Serializable,Parameter
public class ConstantParameter extends AbstractParameter implements Parameter, java.io.Serializable
A ConstantParameter should be used to pass in "constant" arguments to constructors. This includesStrings,Integers or any other object that is not registered in the container.- Author:
- Jon Tirsén, Aslak Hellesøy, Jörg Schaible, Thomas Heller
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.picocontainer.Parameter
Parameter.DelegateResolver, Parameter.NotResolved, Parameter.Resolver, Parameter.ValueResolver
-
-
Constructor Summary
Constructors Constructor Description ConstantParameter(java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(PicoVisitor visitor)Visit the currentParameter.protected booleanisAssignable(java.lang.reflect.Type expectedType)Parameter.Resolverresolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Check if the Parameter can satisfy the expected type using the container.voidverify(PicoContainer container, ComponentAdapter<?> adapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)Verify that the Parameter can satisfy the expected type using the container-
Methods inherited from class org.picocontainer.parameters.AbstractParameter
isResolvable, resolveInstance
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.picocontainer.Parameter
isResolvable, resolveInstance
-
-
-
-
Method Detail
-
resolve
public Parameter.Resolver resolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding)
Description copied from interface:ParameterCheck if the Parameter can satisfy the expected type using the container.- Specified by:
resolvein interfaceParameter- Parameters:
container- the container from which dependencies are resolved.forAdapter- theComponentAdapterthat 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 disambiguation- Returns:
trueif the component parameter can be resolved.
-
verify
public void verify(PicoContainer container, ComponentAdapter<?> adapter, java.lang.reflect.Type expectedType, NameBinding expectedNameBinding, boolean useNames, java.lang.annotation.Annotation binding) throws PicoException
Verify that the Parameter can satisfy the expected type using the container- Specified by:
verifyin interfaceParameter- Parameters:
container- the container from which dependencies are resolved.adapter- theComponentAdapterthat is asking for the verificationexpectedType- the required typeexpectedNameBinding- Expected parameter name- Throws:
PicoCompositionException- if parameter and its dependencies cannot be resolvedPicoException- See Also:
Parameter.verify(org.picocontainer.PicoContainer,org.picocontainer.ComponentAdapter,java.lang.reflect.Type,org.picocontainer.NameBinding,boolean,java.lang.annotation.Annotation)
-
isAssignable
protected boolean isAssignable(java.lang.reflect.Type expectedType)
-
accept
public void accept(PicoVisitor visitor)
Visit the currentParameter.- Specified by:
acceptin interfaceParameter- Parameters:
visitor- the visitor.- See Also:
Parameter.accept(org.picocontainer.PicoVisitor)
-
-