PicoContainer
  1. PicoContainer
  2. PICO-293

Annotation extension for picocontainer

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      3

      Description

      Since all the Guice stuff really saves me typing and allows me to write cleaner code (whethever this is a more or less a pure "IoC" approach), I decided to try adding annotations processing into pico as well as implicit binding. So far I implemented @Inject, @Singleton, @ImplementedBy.

      public class Cat implements CatSoul {

      @Inject
      private Mouse mouse;

      @Inject
      private ExtendedPicoContainer container;

      public Mouse getMouse()

      { return mouse; }

      public ExtendedPicoContainer getContainer()

      { return container; }

      }

      @ImplementedBy(Cat.class)
      public interface CatSoul {
      public abstract Mouse getMouse();
      }

      and then you can write
      ExtendedPicoContainer pico = new DefaultExtendedContainer();
      CatSoul cat = pico.get(CatSoul.class);
      assertNotNull(cat);
      assertNotNull(cat.getMouse());

      1. picocontainer-src.patch
        44 kB
        Erik Putrycz
      2. pom.xml.patch
        3 kB
        Erik Putrycz

        People

        • Assignee:
          Unassigned
          Reporter:
          Erik Putrycz
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: