Forum: JRuby JRuby class with BeanInfo capabilities

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
61ddaf7702fb0a4bff8f7345c958319c?d=identicon&s=25 "Anders Engström" <> (Guest)
on 2013-11-21 10:59
(Received via mailing list)

This is the scenario: I'm using JRuby to create a small DSL for creating
Apache Camel routes in an OSGi environment. Things are working nicely,
and it's possible to load jruby scripts such as:

     require 'lib/dsl'
     Route.create do

This works for simple camel-routes, but what I'd like to do is to use
some of the 'bean-binding' capabilities in Camel components (for example
Xstream - to marshall to/from XML):

     class PersonType
         attr_accessor :id, :name

     xs =
     xs.alias("person", PersonType.java_class)
     fmt =

     # The XML files would look like:
     # <list>
     #   <person>
     #       <id>2</id>
     #       <name>Foo</name>
     #   </person>
     #   <person>....</person>
     # </list>
     from("file:some/path").marshal().string().unmarshal(fmt).process do
         # Process the XML data as a list of Person instances.

This fails because (I believe) the PersonType.java_class does not return
a JavaBean compatible class.

I've made some experiments to create a Ruby class and have it "quack"
like a java-bean by looking at it with the java.beans.Introspector -
but without success.

Any ideas on how to approach this?

Best Regards //Anders
This topic is locked and can not be replied to.