[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Java-Annotations in Ruby?

Marc Heiler

12/23/2007 7:48:00 PM

Hi,

In java one can do annotations in front of method declarations:

http://java.sun.com/j2se/1.5.0/docs/guide/language/annota...


@AjaxCallable public static void deleteImage(int imageId) { .. }

I think I have not understood it completely. I am trying to "translate"
this to
ruby. Is there a way to associate these with a method?
--
Posted via http://www.ruby-....

4 Answers

Thomas Wieczorek

12/26/2007 2:22:00 AM

0

On Dec 23, 2007 8:47 PM, Marc Heiler <shevegen@linuxmail.org> wrote:
>
> I think I have not understood it completely. I am trying to "translate"
> this to
> ruby. Is there a way to associate these with a method?
>

I am just reading Matz's Ruby plans for the
future(http://www.rubyist.net/~matz/slides/rc2005/mgp...).
Annotations are on the wishlist, but I have no idea how far they got.

Marc Heiler

12/26/2007 3:41:00 AM

0

> Annotations are on the wishlist, but I have no idea how far they got.

I am totally "neutral" on this - right now I try to understand if, and
where, these things have any advantage (for ruby. I am sure in Java they
may have some advantages, but I don't know Java really anyway...)

If one of you has an example for a use case of it please forward with it
:-)
--
Posted via http://www.ruby-....

Robert Klemme

12/26/2007 10:46:00 AM

0

On 26.12.2007 04:41, Marc Heiler wrote:
>> Annotations are on the wishlist, but I have no idea how far they got.
>
> I am totally "neutral" on this - right now I try to understand if, and
> where, these things have any advantage (for ruby. I am sure in Java they
> may have some advantages, but I don't know Java really anyway...)
>
> If one of you has an example for a use case of it please forward with it
> :-)

You could search the archives for "method metadata" or "metadata" in
general. There are various approaches how metadata can be "attached" to
methods.

But since you state you do not know Java really, I am wondering what it
is that you are looking for. You say the concept of Java annotations is
not clear to you and yet you expect explanations how to do this in Ruby.
What do you need that for?

Regards

robert

Trans

12/27/2007 6:31:00 PM

0

Facets has an annotations system

http://facets.rubyforge.org/rdoc/an...

very simple to use:

ann :some_method, :annotation_name => "foovalue", ...

ann :some_method, :annotation_name
=> "foovalue"

T.