[picocontainer-dev] pico3 goals

Paul Hammant <[email protected]> Tue, 1 Jun 2010 08:13:20 -0500
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
--00163630eae1c965e70487f7bc5e
Content-Type: text/plain; charset=ISO-8859-1

OK so I've been refactoring away in the Git repo:

     http://xircles.codehaus.org/projects/picocontainer/repo/git/repo
(mirror http://github.com/paul-hammant/picocontainer).

It is stable, but there are some large things to do before I'm happy.

1) JSR 330 compatibility.  Sadly this is stuck behind JSR330's TCK not being
in the Maven repos ( http://jira.codehaus.org/browse/MAVENUPLOAD-2738 and
http://jira.codehaus.org/browse/MREPOSITORY-22 )

  There are some weird types of injection that JSR330 supports that will
require some more work, even though we may not recommend them.
  JSR 330 also suggests it can inject into static fields/methods, but that's
optional so we'll ignore it.

  We'll also have to do more work to support direct injection of generics
here.

2) introducing a new style of use

  pico.addComponent(named("apple", GrannySmiths.class));  // GrannySmiths is
the type and the impl
  pico.addComponent(named("apple", GrannySmiths.class),
MyGrannySmiths.class);  // GrannySmiths is the type,  MyGrannySmiths is the
impl
  pico.addComponent(annotated(Orange.class, Seville.class)); // Seveille is
the type and the impl
  pico.addComponent(annotated(Orange.class, Seville.class),
SomeSeville.class); // Seveille is the type, SomeSeville is the impl.

  named(..) and annotated(..) would make a key object.  The
MutablePicoContainer API could be changed :

  mpc.addComponent(Key key, Class impl);  // for binding to name/annotation
  mpc.addComponent(Class key, Class impl); // situations without binding
annotation/names

  The current codebase is close already with Key.annotatedKey(..) but it
needs to be expanded a little to  incorporate named(..) and added to the MPC
interface

  Alternatively, we could have

     pico.addComponent(Class key, Class impl) // and with parameters
overload, and no-key overload
     pico.addNamedComponent(String name, Class key, Class impl) // and with
parameters overload
     pico.addAnnotatedComponent(Class<? extends Annotation> annotated, Class
key, Class impl) // and with parameters overload

  Alternatively #2, we could have:

     pico.addComponent(Class key, Class impl) // and with parameters
overload, and no-key overload
     pico.withName(String name).addComponent(Class key, Class impl)
     pico.withAnnotation(Class<? extends Annotation>
annotation).addComponent(Class key, Class impl)

Those are the two biggies for me.

As it happens I pushed out a beta of mockpico (
http://github.com/paul-hammant/mockpico .. scroll down to see pretty diagram
) which contains a shaded version of 3.0-SNAPSHOT.

- Paul

--00163630eae1c965e70487f7bc5e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

OK so I&#39;ve been refactoring away in the Git repo:<br><br>=A0=A0=A0=A0 <=
a href=3D"http://xircles.codehaus.org/projects/picocontainer/repo/git/repo"=
 target=3D"_blank">http://xircles.codehaus.org/projects/picocontainer/repo/=
git/repo</a>=A0 (mirror <a href=3D"http://github.com/paul-hammant/picoconta=
iner" target=3D"_blank">http://github.com/paul-hammant/picocontainer</a>).<=
br>


<br>It is stable, but there are some large things to do before I&#39;m happ=
y.<br><br>1) JSR 330 compatibility.=A0 Sadly this is stuck behind JSR330&#3=
9;s TCK not being in the Maven repos ( <a href=3D"http://jira.codehaus.org/=
browse/MAVENUPLOAD-2738" target=3D"_blank">http://jira.codehaus.org/browse/=
MAVENUPLOAD-2738</a> and <a href=3D"http://jira.codehaus.org/browse/MREPOSI=
TORY-22" target=3D"_blank">http://jira.codehaus.org/browse/MREPOSITORY-22</=
a> )<br>
<br>=A0 There are some weird types of injection that JSR330 supports that w=
ill require some more work, even though we may not recommend them.=A0 <br>=
=A0 JSR 330 also suggests it can inject into static fields/methods, but tha=
t&#39;s optional so we&#39;ll ignore it.<br>
<br>=A0 We&#39;ll also have to do more work to support direct injection of =
generics here.<br><br>2) introducing a new style of use<br><br>=A0 pico.add=
Component(named(&quot;apple&quot;, GrannySmiths.class));=A0 // GrannySmiths=
 is the type and the impl<br>
=A0 pico.addComponent(named(&quot;apple&quot;, GrannySmiths.class), MyGrann=
ySmiths.class);=A0 // GrannySmiths
 is the type,=A0 MyGrannySmiths is the impl<br>
=A0 pico.addComponent(annotated(Orange.class, Seville.class)); // Seveille =
is the type and the impl<br>=A0 pico.addComponent(annotated(Orange.class, S=
eville.class), SomeSeville.class); //=20
Seveille is the type, SomeSeville is the impl.<br><br>=A0 named(..) and ann=
otated(..) would make a key object.=A0 The MutablePicoContainer API could b=
e changed :<br><br>=A0 mpc.addComponent(Key key, Class impl);=A0 // for bin=
ding to name/annotation<br>

=A0 mpc.addComponent(Class key, Class impl); // situations without binding =
annotation/names<br><br>=A0 The current codebase is close already with Key.=
annotatedKey(..) but it needs to be expanded a little to=A0 incorporate nam=
ed(..) and added to the MPC interface<br>
<br>=A0 Alternatively, we could have<br><br>=A0=A0 =A0 pico.addComponent(Cl=
ass key, Class impl) // and with parameters overload, and no-key overload<b=
r>=A0=A0 =A0 pico.addNamedComponent(String name, Class key, Class impl) // =
and with parameters overload<br>

=A0=A0 =A0 pico.addAnnotatedComponent(Class&lt;? extends Annotation&gt; ann=
otated, Class key, Class impl) // and with parameters overload<br><br>=A0 A=
lternatively #2, we could have:<br><br>=A0=A0 =A0 pico.addComponent(Class k=
ey, Class impl) // and with parameters=20
overload, and no-key overload<br>
=A0=A0=A0=A0 pico.withName(String name).addComponent(Class key, Class impl)=
<br>

=A0=A0=A0=A0 pico.withAnnotation(Class&lt;? extends Annotation&gt; annotati=
on).addComponent(Class key, Class impl)<br>


<br>Those are the two biggies for me.<br><br>As it happens I pushed out a b=
eta of mockpico ( <a href=3D"http://github.com/paul-hammant/mockpico">http:=
//github.com/paul-hammant/mockpico</a> .. scroll down to see pretty diagram=
 ) which contains a shaded version of 3.0-SNAPSHOT.<br>

<br>- Paul<br><br>

--00163630eae1c965e70487f7bc5e--