On Fri, Jan 15, 2010 at 7:18 AM, Marco D. [email protected] wrote:
jackrabbit as a kind of database.
Has anyone some hints?
Yes, the support is there, but it is still relatively new and still
subject to some change and hopefully improvements.
The basics of what is there right now boil down to the following:
- require ‘jruby/core_ext’. This loads the annotation methods into
the Class class.
signature_array_with_return_type_first) sets a Java method signature
for a Ruby method on the class.
hash_with_annotation_type_keys_to_hash_values) set a method annotation
on a Ruby method.
does the same but puts the annotation on the Ruby class.
- add_parameter_annotations(method_name, array_of_annotation_hashes)
adds annotations to the parameters.
- When you’ve set all the signature and annotations on your Ruby
classes, you call Class.becom_java! to turn the Ruby class into a real
Java class that you can now hand to Java APIs that look for
My ruby-jersey stuff contains some small wrappers around these
low-level methods so that I could create something that looked like a
Ruby-ish annotation API in the code. Take a look at lib/annotated.rb
and lib/ruby-jersey.rb to see what I did.
The biggest limitations of this API so far are that 1) become_java!
can only be called once, and has to be done at runtime; 2) the
signature and annotation methods need existing class types to be
defined, so you can’t do annotations that refer to other Ruby-defined
If you decide to play with the APIs, please share some examples and
let us know what works and what doesn’t. We’ll almost certainly be
improving that area of the code for the 1.5 release and beyond.
To unsubscribe from this list, please visit: