[seam-dev] First cab off the rank!

Stuart Douglas stuart at baileyroberts.com.au
Mon Nov 30 16:53:47 EST 2009


There are only two, AnnotationCache and AnnotationInvocationHandler, I have attached them in a zip. I was not sure what package you want to put them in so I have left them as is.

AnnotationCache provides the public interface, and as the name suggests caches proxy instances so that a new one is not created each time.

Stuart 



________________________________________
From: Pete Muir [pmuir at redhat.com]
Sent: Monday, 30 November 2009 11:34 PM
To: Stuart Douglas
Subject: Re: [seam-dev] First cab off the rank!

Stuart, can we merge this stuff into Weld extensions? Can you give me a pointer to which classes to merge, or better yet a patch?

On 30 Nov 2009, at 07:08, Stuart Douglas wrote:

> Forgot to CC to seam-dev again.
> ________________________________________
> From: Stuart Douglas
> Sent: Monday, 30 November 2009 6:06 PM
> To: Shane Bryzak
> Subject: RE: [seam-dev] First cab off the rank!
>
> No, it will support them, the special case stuff for the primitives is so you don't have to be that careful about your types. e.g. :
>
> public @interface SomeAnnotation
> {
>   long value();
> }
>
> you can do
>
> map.put("value",10);
>
> rather than
>
> map.put("value",new Long(10));
>
> Feel free to steal it, most of was stoled from AnnotationLiteral anyway. I think it would be good to get stuff like this and Gavin's Reannotated* classes and put them in some kind of extension utils module.
>
> Stuart
>
>
> ________________________________________
> From: Shane Bryzak [sbryzak at redhat.com]
> Sent: Monday, 30 November 2009 5:58 PM
> To: Stuart Douglas
> Cc: Gavin King; seam-dev at lists.jboss.org
> Subject: Re: [seam-dev] First cab off the rank!
>
> Looks good Stuart, I might have to steal some of your code - it doesn't
> seem to support enum or class member values though, is that right?
>
> On 30/11/09 14:31, Stuart Douglas wrote:
>> I have done up a quick and dirty one using JDK proxies, that seems to work ok (all my XML config tests pass and most of the code was stolen from AnnotationLiteral).
>>
>> The class that creates the proxy:
>>
>> http://bazaar.launchpad.net/~stuart-baileyroberts/jbraze/trunk/annotate/head%3A/spi-tools/src/main/java/org/jbraze/spitools/AnnotationCache.java
>>
>> The InvocationHandler:
>>
>> http://bazaar.launchpad.net/~stuart-baileyroberts/jbraze/trunk/annotate/head%3A/spi-tools/src/main/java/org/jbraze/spitools/AnnotationInvocationHandler.java
>>
>> To create an instance you go
>>
>> AnnotationCache.getAnnotation(MyAnnotation.class,memberValues);
>>
>> where memberValues is a<String,Object>  map of the annotations member values.
>>
>> Stuart
>> ________________________________________
>> From: Gavin King [gavin.king at gmail.com]
>> Sent: Monday, 30 November 2009 2:53 PM
>> To: Stuart Douglas; Weld-Dev
>> Subject: Re: [seam-dev] First cab off the rank!
>>
>> On Sun, Nov 29, 2009 at 10:39 PM, Gavin King<gavin.king at gmail.com>  wrote:
>>
>>> Yes, you're right. So you would need to implement the annotation @interface.
>>>
>>> On Sun, Nov 29, 2009 at 10:27 PM, Stuart Douglas
>>> <stuart at baileyroberts.com.au>  wrote:
>>>
>>>> What about for @NonBinding members? Won't implementations need to perform their own equality check if there are non binding members?
>>>>
>>>> Stuart
>>>>
>>>> ________________________________________
>>>> From: Gavin King [gavin.king at gmail.com]
>>>> Sent: Monday, 30 November 2009 1:22 PM
>>>> To: Shane Bryzak
>>>> Cc: Stuart Douglas; seam-dev at lists.jboss.org
>>>> Subject: Re: [seam-dev] First cab off the rank!
>>>>
>>>> Yeah. Probably you could just stick the members in an array. You
>>>> probably don't need to actually implement the annotation interface.
>>>> You would only need to implement Annotation.
>>>>
>>>> Well, the spec does not say explicitly that this would work, but it
>>>> seems fairly safe.
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Nov 29, 2009, at 9:07 PM, Shane Bryzak<sbryzak at redhat.com>  wrote:
>>>>
>>>>
>>>>> Good point - isn't this simply a case though of implementing the
>>>>> equals() and hashCode() methods and checking that the members are
>>>>> equal,
>>>>> i.e. the same way that AnnotationLiteral does it?
>>>>>
>>>>> On 30/11/09 06:36, Stuart Douglas wrote:
>>>>>
>>>>>> Does it still work when the annotation has members? That was why I
>>>>>> needed the javassist.
>>>>>>
>>>>>> Stuart
>>>>>>
>>>>>> ________________________________________
>>>>>> From: seam-dev-bounces at lists.jboss.org [seam-dev-
>>>>>> bounces at lists.jboss.org] On Behalf Of Shane Bryzak
>>>>>> [sbryzak at redhat.com]
>>>>>> Sent: Monday, 30 November 2009 5:34 AM
>>>>>> To: Gavin King
>>>>>> Cc: seam-dev at lists.jboss.org
>>>>>> Subject: Re: [seam-dev] First cab off the rank!
>>>>>>
>>>>>> Nope, just wrote my own impl of Annotation which I could then pass
>>>>>> into
>>>>>> BeanManager.getBeans().
>>>>>>
>>>>>> On 30/11/09 04:32, Gavin King wrote:
>>>>>>
>>>>>>
>>>>>>> You used a jdk dynamicproxy? Probably a better idea.
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>> On Nov 29, 2009, at 1:01 PM, Shane Bryzak<sbryzak at redhat.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Done, although I didn't need to use Javassist. ;)
>>>>>>>>
>>>>>>>> On 30/11/09 02:38, Gavin King wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>> Stuart has some code to do this using javassist.
>>>>>>>>>
>>>>>>>>> On Sun, Nov 29, 2009 at 2:00 AM, Shane Bryzak<sbryzak at redhat.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Almost got this working, however I need to be able to
>>>>>>>>>> reflectively
>>>>>>>>>> create an
>>>>>>>>>> AnnotationLiteral, given a String containing the fully qualified
>>>>>>>>>> name of the
>>>>>>>>>> qualifier.  Anyone done this before?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>> _______________________________________________
>>>>>> seam-dev mailing list
>>>>>> seam-dev at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> seam-dev mailing list
>>>>> seam-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>>>
>>>>
>>>
>>>
>>> --
>>> Gavin King
>>> gavin.king at gmail.com
>>> http://in.relation.to/Bloggers/Gavin
>>> http://hibernate.org
>>> http://seamframework.org
>>>
>>>
>>
>>
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>>
>> _______________________________________________
>> seam-dev mailing list
>> seam-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: annotation-creator.zip
Type: application/x-sdlc
Size: 3115 bytes
Desc: annotation-creator.zip
Url : http://lists.jboss.org/pipermail/seam-dev/attachments/20091201/d321d12f/attachment.bin 


More information about the seam-dev mailing list