Thomas E Enebo wrote:
To get my jmonkeyengine demo working, I had to be able to expose a
bunch of protected Java fields to be accessible. I ended up creating
the following methods (currently implemented in Ruby):
field_attr_reader :java_field_name [, :name_to_expose_as]
field_attr_writer :java_field_name [, :name_to_expose_as]
field_attr_accessor :java_field_name [, :name_to_expose_as]
This is pretty close to Ruby equivalent syntax and was very useful.
If the second parm is not provided the actual java field name is used.
Comments to solicit:
1. Anyone have a better name to suggest for this?
Why not just
field_reader, field_writer and field_accessor?
2. Alternate syntax suggestions?
The syntax looks fine.
>From my perspective, I am not really excited about a bunch of "magic"
aliases to exposing a field since this is already an explicit
operation. I prefer to provide the :name_to_expose_as as a way of
providing a nicer name if the java field name sucks. Comments?
I plan on putting new methods for handling fields in 1.1.5, so make
sure your voice is heard if you want something different.
-Tom
--
Ola Bini (http://olabini.com)
JRuby Core Developer
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)
"Yields falsehood when quined" yields falsehood when quined.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email