public class ComponentParameter extends BasicComponentParameter
Array
,Collection
and
Map
.Parameter.DelegateResolver, Parameter.NotResolved, Parameter.Resolver, Parameter.ValueResolver
Modifier and Type | Field and Description |
---|---|
static ComponentParameter |
ARRAY
Use
ARRAY as Parameter for an Array that must have elements. |
static ComponentParameter |
ARRAY_ALLOW_EMPTY
Use
ARRAY_ALLOW_EMPTY as Parameter for an Array that may have no
elements. |
static ComponentParameter |
DEFAULT
DEFAULT is an instance of ComponentParameter using the default constructor. |
BASIC_DEFAULT
Constructor and Description |
---|
ComponentParameter()
Expect any scalar parameter of the appropriate type or an
Array . |
ComponentParameter(boolean emptyCollection)
Expect any scalar parameter of the appropriate type or an
Array . |
ComponentParameter(Class componentValueType,
boolean emptyCollection)
|
ComponentParameter(Class componentKeyType,
Class componentValueType,
boolean emptyCollection)
|
ComponentParameter(Object componentKey)
Expect a parameter matching a component of a specific key.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PicoVisitor visitor)
Accept the visitor for 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.
|
void |
verify(PicoContainer container,
ComponentAdapter<?> adapter,
Type expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Verify that the Parameter can satisfy the expected type using the container
|
findInjectorOrInstanceAdapter, makeFoundAmbiguousStrings, resolveAdapter
isResolvable, resolveInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isResolvable, resolveInstance
public static final ComponentParameter DEFAULT
DEFAULT
is an instance of ComponentParameter using the default constructor.public static final ComponentParameter ARRAY
ARRAY
as Parameter
for an Array that must have elements.public static final ComponentParameter ARRAY_ALLOW_EMPTY
ARRAY_ALLOW_EMPTY
as Parameter
for an Array that may have no
elements.public ComponentParameter(Object componentKey)
componentKey
- the key of the desired addComponentpublic ComponentParameter()
Array
.public ComponentParameter(boolean emptyCollection)
Array
.
Resolve the parameter even if no compnoent is of the array's component type.emptyCollection
- true
allows an Array to be emptypublic ComponentParameter(Class componentValueType, boolean emptyCollection)
Array
,Collection
or Map
.
The components in the collection will be of the specified type.componentValueType
- the component's type (ignored for an Array)emptyCollection
- true
allows the collection to be emptypublic ComponentParameter(Class componentKeyType, Class componentValueType, boolean emptyCollection)
Array
,Collection
or Map
.
The components in the collection will be of the specified type and their adapter's key
must have a particular type.componentKeyType
- the component adapter's key typecomponentValueType
- the component's type (ignored for an Array)emptyCollection
- true
allows the collection to be emptypublic Parameter.Resolver resolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
BasicComponentParameter
resolve
in interface Parameter
resolve
in class BasicComponentParameter
container
- the container from which dependencies are resolved.forAdapter
- the ComponentAdapter
that 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 disambiguationbinding
- @return true
if the component parameter can be resolved.true
if the Parameter can be verified.Parameter#isResolvable(PicoContainer, ComponentAdapter, Class, NameBinding ,boolean, Annotation)
public void verify(PicoContainer container, ComponentAdapter<?> adapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
Parameter
verify
in interface Parameter
verify
in class BasicComponentParameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the verificationexpectedType
- the required typeexpectedNameBinding
- Expected parameter namepublic void accept(PicoVisitor visitor)
Parameter
. If internally a
CollectionComponentParameter
is used, it is visited also.accept
in interface Parameter
accept
in class BasicComponentParameter
visitor
- the visitor.BasicComponentParameter.accept(org.picocontainer.PicoVisitor)
Copyright © 2003–2016 Codehaus. All rights reserved.