Details
-
Type: Improvement
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-5
-
Fix Version/s: 1.0-beta-5
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
I would like to suggest passing the expected type of the argument to
the resolveAdapter method.
The expected types are always explicitly known at the moment of the resolution, so there is no extra effort required.
Paramter implementations that don't need this information may safely ignore it - there is no impact on existing implemenations except method signature change.
Passing the type allows doing some some neat stuff:
1) smart ComponentParameter() that looks up the required value in the
componentRegistry using argument's expected type as a key. Fixes PICO-59, see accompanying patch.
2) implementing a StringParamter(String stringValue) that performs the
conversion of the value to the argument's expected type, at the time of resolution, see http://tinyurl.com/2bvme
3) implementing a SequenceParameter(Parameter[]) that can be using for hinting attributes of composite types (Java arrays, and java.util.Collection flavours), related to PICO-33, see http://tinyurl.com/22rpo
As for the latter two I would love to see them folded into PicoContainer (3) and PicoExtras-reflections (2). Contact me if you are interested.
Issue Links
- depends upon
-
PICO-59 ComponentParameter no-arg constructor
Activity
Field | Original Value | New Value |
---|---|---|
Attachment | ExpectedType.diff [ 11233 ] |
Fix Version/s | 1.0-beta-4 [ 10412 ] |
Attachment | expectedType2.diff [ 11241 ] |
Fix Version/s | 1.0-beta-4 [ 10412 ] | |
Environment | ||
Fix Version/s | 1.0 [ 10145 ] | |
Affects Version/s | 1.0 [ 10145 ] |
Attachment | expectedType3.diff [ 11308 ] |
Assignee | Aslak Hellesoy [ rinkrank ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
a patch that performs described changes