Auto mapping of setters/getters?

Hi,

After quite a long time, I’ve been looking at upgrading my application’s
JRuby support from somewhere on the order of 0.3.x (or thereabouts) up
to 1.1.1. One of the things my application does is generate classes on
the fly (using bcel), with a number of getters/setters for various
properties on the classes.

The java support in the earlier jruby automatically mapped these methods
so that instead of obj.setField(value) I could do obj.Field=value.
However, with 1.1.1 I get a “method not found” error. (similarly with
getters). I’ve tried to search the mailing list archives in regards to
getters/setters and get lots of references to Active Records and rails
and stuff… but nothing that directly addresses my need (I don’t need
any of that other stuff… I’m not writing web applications or anything
like that - simple data processing stuff with scripting support). This
works seemlessly with the bsh scripting engine, and as I said, it worked
fine with an older JRuby, but I’m at a loss as to where to begin to get
it working with the latest JRuby.

Any pointers to a solution appreciated.

Thanks,

Gabriel


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 5/11/08, Gabriel H. [email protected] wrote:

The java support in the earlier jruby automatically mapped these methods
so

that instead of obj.setField(value) I could do obj.Field=value. However,
with 1.1.1 I get a “method not found” error. (similarly with getters).

That should still work, but with the first character following ‘set’
lower-cased (i.e., obj.field = value). Also, it will currently only
work
with public methods (not sure if that was the case with the antiq… –
er,
I mean venerable – JRuby 0.3.x :slight_smile: ).

-Bill

Hmmm… yes, it does do that. Thanks. Do you know if there’s any way to
alter that so that it uses uppercase first letters?

Gabriel

Bill D. wrote:

lower-cased (i.e., obj.field = value). Also, it will currently only
work with public methods (not sure if that was the case with the
antiq… – er, I mean venerable – JRuby 0.3.x :slight_smile: ).

-Bill


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I am using BSF (still) as the scripting engine. BSF (unlike javax.script
api - unless I’ve missed it?) supports script termination via the
terminate() method call. The JRuby bsf engine implementation implements
the terminate() method, yet if my application actually calls that method
the script keeps right on running to its conclusion. Is there any
clean way to terminate a running JRuby script prematurely?

Gabriel


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs