PicoContainer
  1. PicoContainer
  2. PICO-323

Handle differentiation of components by Type rather than Class.

    Details

    • Type: Wish Wish
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      All references to java.lang.Class for use for a key and implementation should be changed to Type so we can differentiate between:

      List<String>
      

      and

      List<Integer>
      

      as constructor arguments.

      Test Case:

          /**
           * Sample class that demonstrates literal collection handling.
           */
          public static class Searcher {
          	private final List<String> searchPath;
      
          	public Searcher(List<String> searchPath) {
          		this.searchPath = searchPath;
          	}
      
          	public List<String> getSearchPath() {
          		return searchPath;
          	}
          }
          
      
          /**
           * @todo Revisit this for Pico 3.
           */
          @Test
          public void canInstantiateAutowiredCollectionThatAreDefinedImplicitly() {
          	MutablePicoContainer pico = new DefaultPicoContainer(new Caching());
          	List<String> searchPath = new ArrayList<String>();
          	searchPath.add("a");
          	searchPath.add("b");
      
          	List<Integer> conflictingList = new ArrayList<Integer>();
          	conflictingList.add(1);
          	conflictingList.add(2);
          	pico.addComponent("conflict", conflictingList);
          	
          	pico.addComponent("searchPath",searchPath)
          		.addComponent(Searcher.class);
      
          	assertNotNull(pico.getComponent(Searcher.class));
          	assertNotNull(pico.getComponent(Searcher.class).getSearchPath());
          }
      
      

        Issue Links

          People

          • Assignee:
            Paul Hammant
            Reporter:
            Michael Rimov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: