|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.parameters.CollectionComponentParameter
org.picocontainer.gems.constraints.AbstractConstraint
public abstract class AbstractConstraint
Base class for parameter constraints.
Field Summary |
---|
Fields inherited from class org.picocontainer.parameters.CollectionComponentParameter |
---|
ARRAY, ARRAY_ALLOW_EMPTY |
Fields inherited from interface org.picocontainer.Parameter |
---|
DEFAULT, ZERO |
Constructor Summary | |
---|---|
protected |
AbstractConstraint()
Construct an AbstractContraint. |
Method Summary | |
---|---|
abstract boolean |
evaluate(ComponentAdapter adapter)
Evaluate whether the given component adapter will be part of the collective type. |
protected Map<Object,ComponentAdapter<?>> |
getMatchingComponentAdapters(PicoContainer container,
ComponentAdapter adapter,
Class keyType,
Class valueType)
Collect the matching ComponentAdapter instances. |
boolean |
isResolvable(PicoContainer container,
ComponentAdapter adapter,
Class expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Check for a successful dependency resolution of the parameter for the expected type. |
Object |
resolveInstance(PicoContainer container,
ComponentAdapter adapter,
Class expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Resolve the parameter for the expected type. |
void |
verify(PicoContainer container,
ComponentAdapter adapter,
Class expectedType,
NameBinding expectedNameBinding,
boolean useNames,
Annotation binding)
Verify a successful dependency resolution of the parameter for the expected type. |
Methods inherited from class org.picocontainer.parameters.CollectionComponentParameter |
---|
accept |
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 |
---|
accept |
Constructor Detail |
---|
protected AbstractConstraint()
Method Detail |
---|
public Object resolveInstance(PicoContainer container, ComponentAdapter adapter, Class expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding) throws PicoCompositionException
CollectionComponentParameter
null
If the expected type is not one of the collection types Array
,
Collection
or Map
. An empty collection is only a valid resolution, if
the emptyCollection
flag was set.
resolveInstance
in interface Parameter
resolveInstance
in class CollectionComponentParameter
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.expectedNameBinding
- Expected parameter name
null
PicoCompositionException
- if a referenced component could not be instantiated.public boolean isResolvable(PicoContainer container, ComponentAdapter adapter, Class expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding) throws PicoCompositionException
CollectionComponentParameter
Array
,Collection
or Map
. An empty collection is only a valid
resolution, if the emptyCollection
flag was set.
isResolvable
in interface Parameter
isResolvable
in class CollectionComponentParameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the instanceexpectedType
- the required typeexpectedNameBinding
- Expected parameter name
true
if matching components were found or an empty collective type
is allowed
PicoCompositionException
public void verify(PicoContainer container, ComponentAdapter adapter, Class expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding) throws PicoCompositionException
CollectionComponentParameter
Array
,
Collection
or Map
. An empty collection is only a valid resolution, if
the emptyCollection
flag was set.
verify
in interface Parameter
verify
in class CollectionComponentParameter
container
- the container from which dependencies are resolved.adapter
- the ComponentAdapter
that is asking for the verificationexpectedType
- the required typeexpectedNameBinding
- Expected parameter name
PicoCompositionException
- if parameter and its dependencies cannot be resolvedpublic abstract boolean evaluate(ComponentAdapter adapter)
CollectionComponentParameter
evaluate
in interface Constraint
evaluate
in class CollectionComponentParameter
adapter
- a ComponentAdapter
value
true
if the adapter takes partprotected Map<Object,ComponentAdapter<?>> getMatchingComponentAdapters(PicoContainer container, ComponentAdapter adapter, Class keyType, Class valueType)
CollectionComponentParameter
getMatchingComponentAdapters
in class CollectionComponentParameter
container
- container to use for dependency resolutionadapter
- ComponentAdapter
to excludekeyType
- the compatible type of the keyvalueType
- the compatible type of the addComponent
Map
with the ComponentAdapter instances and their component keys as map key.
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |