Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 1.0-beta-1
-
Fix Version/s: None
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
Guys,
Here is a better draft at implementing support for multiple implementations in HierarchicalPicoContainer. To support this thing:
public class Component {
public Component(OtherComponent []others, String []keys);
}
The patch is taken from the src directory.
There is a new exception class picocontainer.hierarchical.InconsistentLookupTypeRegistrationException which I also attach.
Cheers,
Mike
Activity
Mike Hogan
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | patch.diff [ 10381 ] |
Mike Hogan
made changes -
Attachment | InconsistentLookupTypeRegistrationException.java [ 10382 ] |
Aslak Hellesøy
made changes -
Status | Unassigned [ 1 ] | Assigned [ 2 ] |
Assignee | Mike Hogan [ m081072 ] |
Aslak Hellesøy
made changes -
Affects Version/s | 1.0-beta-1 [ 10144 ] | |
Original Estimate | 0 | |
Fix Version/s | 1.0-beta-1 [ 10144 ] | |
Remaining Estimate | 0 minutes [ 0 ] |
Mike Hogan
made changes -
Resolution | Duplicate [ 3 ] | |
Status | Assigned [ 2 ] | Closed [ 6 ] |
Fix Version/s | 1.0-beta-1 [ 10144 ] |
Refactoring steps in case I have to do it again:
1. Refactor HierarchicalPicoContainer to use methods to access componentTypeToInstanceMap
2. Refactor so that componentTypeToInstanceMap contains a map, keyed by component. Redundant for now.
3. Rename componentTypeToInstanceMap to componentTypeToLookupMap
4. Add key to ComponentSpecification
5. Enable first commented out test case in HierarchicalPicoContainerTestCase - testCannotMixLookupTypesWithKeyFirst
6. Add void registerComponent(Class componentType, Class componentImplementation, String key) throws PicoRegistrationException to ClassRegistrationPicoContainer
7. Implement this method in HierarchicalPicoContainer.
8. Add checkLookupTypeConsistency to HierarchicalPicoContainer to help registerComponent.
9. Chain registerComponent methods to call this new one.
10. testCannotMixLookupTypesWithKeyFirst passes.
11. testCannotMixLookupTypesWithTypeFirst passes.
12. testKeepingLookupTypesConsistentWorks passes.
13. Enable commented out test case testCanPassMultipleImplsAsArray
14. Write AnimalConsumer
15. Add Object getComponent(Class componentType, String key); to ClassRegistrationPicoContainer. Maybe should be in PicoContainer but that has to much effect for now.
16. Refactor getImplForType to take a key with special case for null (normal pico behaviour)
17. Refactor mapImplToType to take a key with same special case.
18. Add key to hookEmUp and propagate to mapImplToType
19. Add key to reuseImplementationIfAppropriate and propagate to mapImplToType
20. Add allLookupImplsResolved to help array handling in hookEmUp
21. Replace use of Map.Entry with ComponentInstantiation (because some Map.Entry instances now contain Strings as keys)
22. Re-write for Arrays