jastrachan | 2 Feb 13:34 2005
Picon

Re: Re: using annotations instead of a keyword for bean properties

On 2 Feb 2005, at 12:26, Alan Green wrote:
> Russel Winder wrote:
>
>>> class Person
>>>    <at> Property String name
>>>    <at> Property int age
>>> }
>>>
>>> then it matches the feel of Java 5 annotations?
>> This just makes so much sense I cannot imagine people voting against 
>> it.
>> Of course the only problem is that this is a special form of 
>> annotation
>> not implemented using the usual annotation mechanism.
>
> I suppose the question is: does the compiler have special cases to 
> deal with the  <at> Property annotation?
>
> If a Groovy user could define their own annotation " <at> Foobar" which did 
> the same thing, then capitalised would be the natural way to spell it.
>
> However, if this annotation is special to the compiler, then perhaps 
> it might be better to use all lower case,  <at> property.

The idea is, if, say, in 2.0 we allow generic macros to be attached to 
an annotation, then  <at> Property could be just a default annotation and 
macro shipped with Groovy by default- but that folks could make their 
own  <at> Foobar annotation instead if they liked.

So while currently the implementation of  <at> Property is hard coded in the 
RI as a 'magic' annotation, in 2.0 we'd probably use a more generic 
macro mechanism to implement this feature - such that others can add 
their own macros etc. (e.g. like Python's decorators and like EJB3's 
use of  <at> Remote).

James
-------
http://radio.weblogs.com/0112098/


Gmane