# Java-Annotations in Ruby?

**URL:** <https://www.ruby-forum.com/t/java-annotations-in-ruby/124034>\
**Category:** Ruby\
**Created:** [December 23, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034 "2007-12-23T20:48:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 23, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034/1 "2007-12-23T20:48:01Z")

</div>

Hi,

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

[http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html](http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html)

@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?

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 26, 2007, 3:23am UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034/2 "2007-12-26T03:23:19Z")

</div>

On Dec 23, 2007 8:47 PM, Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/mgp00026.html](http://www.rubyist.net/~matz/slides/rc2005/mgp00026.html)).  
Annotations are on the wishlist, but I have no idea how far they got.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 26, 2007, 4:41am UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034/3 "2007-12-26T04:41:17Z")

</div>

> 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  
🙂

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 26, 2007, 11:50am UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034/4 "2007-12-26T11:50:46Z")

</div>

On 26.12.2007 04:41, Marc H. 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

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 27, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/java-annotations-in-ruby/124034/5 "2007-12-27T19:31:58Z")

</div>

Facets has an annotations system

[http://facets.rubyforge.org/rdoc/annotations/](http://facets.rubyforge.org/rdoc/annotations/)

very simple to use:

ann :some\_method, :annotation\_name =\> “foovalue”, …

ann :some\_method, :annotation\_name  
=\> “foovalue”

T.
