Re: [picocontainer-dev] JSR330 work progress

Paul Hammant <[email protected]> Wed, 4 Aug 2010 08:40:25 -0500
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
--0016361e83ba731abe048cff9361
Content-Type: text/plain; charset=ISO-8859-1

One of the things I'm doing in place is in DefaultPicoContainer is :-

        if (key instanceof Generic) {
            key = Generic.get(((Generic) key).getType());
        }

This unwrapping right ?  Whereas before I see toString tell me FooTestCase$1
for the type name, after I see List<String> as the type name which is much
clearer.

- Paul

On Wed, Aug 4, 2010 at 8:23 AM, Mark Hobson <[email protected]> wrote:

> On 4 August 2010 14:16, Paul Hammant <[email protected]> wrote:
> > Sure sure.  Right now, I just wanted to replace the TypeOf.fromClass()
> and
> > new TypeOf<T>(){} stuff with JType as quickly as possible.   I'll go back
> > through, trying to make things more simple now that all the tests are
> > passing.
>
> Cool, no probs.
>
> > Methods isAssignableFrom and isAssignableTo are more interesting though.
> I
> > could not find equivalent methods on Generic, and was wondering how other
> > users of if fare.
>
> You'd use TypeUtils.isAssignable(Type, Type) and unwrap any Generics
> into Types first.  The idea is that Generic is only used where you
> need a type variable, then it degrades into a Type for general type
> operations.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

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

One of the things I&#39;m doing in place is in DefaultPicoContainer is :-<d=
iv><br></div><div><div>=A0=A0 =A0 =A0 =A0if (key instanceof Generic) {</div=
><div>=A0=A0 =A0 =A0 =A0 =A0 =A0key =3D Generic.get(((Generic) key).getType=
());</div><div>=A0=A0 =A0 =A0 =A0}</div>
<div><br></div><div>This unwrapping right ? =A0Whereas before I see toStrin=
g tell me=A0FooTestCase$1 for the type name, after I see List&lt;String&gt;=
 as the type name which is much clearer.</div><div><br></div><div>- Paul</d=
iv>
<br><div class=3D"gmail_quote">On Wed, Aug 4, 2010 at 8:23 AM, Mark Hobson =
<span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">markhobson@gm=
ail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class=3D"im">On 4 August 2010 14:16, Paul Hammant &lt;<a href=3D"mailt=
o:[email protected]">[email protected]</a>&gt; wrote:<br>
&gt; Sure sure. =A0Right now, I just wanted to replace the TypeOf.fromClass=
() and<br>
&gt; new TypeOf&lt;T&gt;(){} stuff with JType as quickly as possible. =A0 I=
&#39;ll go back<br>
&gt; through, trying to make things more simple now that all the tests are<=
br>
&gt; passing.<br>
<br>
</div>Cool, no probs.<br>
<div class=3D"im"><br>
&gt; Methods isAssignableFrom and isAssignableTo are more interesting thoug=
h. I<br>
&gt; could not find equivalent methods on Generic, and was wondering how ot=
her<br>
&gt; users of if fare.<br>
<br>
</div>You&#39;d use TypeUtils.isAssignable(Type, Type) and unwrap any Gener=
ics<br>
into Types first. =A0The idea is that Generic is only used where you<br>
need a type variable, then it degrades into a Type for general type<br>
operations.<br>
<div><div></div><div class=3D"h5"><br>
Mark<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe from this list, please visit:<br>
<br>
 =A0 =A0<a href=3D"http://xircles.codehaus.org/manage_email" target=3D"_bla=
nk">http://xircles.codehaus.org/manage_email</a><br>
<br>
<br>
</div></div></blockquote></div><br></div>

--0016361e83ba731abe048cff9361--