Converting java accessors to ruby accessors

View: New views
3 Messages — Rating Filter:   Alert me  

Converting java accessors to ruby accessors

by Thomas Williams-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi chaps,
I was wondering if it is currently possible to automatically convert java style getters and setters into their ruby-esque equivalents?

eg, if I have a class like

class Hamster {

  private String colour;

  public String getColour() { return colour; }

  public void setColour(final String colour) { this.colour = colour; }
}

Is it possible to access that you can access it in jruby like this:

myHamster = Hamster.new

myHamster.colour="Gold"

Thanks,
Tom
--
Thomas Williams
Java Programmer
Dubit Limited
+44 1133 947920
www.dubitlimited.com

Re: Converting java accessors to ruby accessors

by Charles Oliver Nutter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Williams wrote:
> Is it possible to access that you can access it in jruby like this:
>
> myHamster = Hamster.new
>
> myHamster.colour="Gold"

That should work now...doesn't it?

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Converting java accessors to ruby accessors

by Thomas Williams-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charles,
You're quite right, it does. Sorry my test was going wrong due to my own noobitude.

Many thanks,
Tom

2008/7/24 Charles Oliver Nutter <charles.nutter@...>:
Thomas Williams wrote:
Is it possible to access that you can access it in jruby like this:

myHamster = Hamster.new

myHamster.colour="Gold"

That should work now...doesn't it?

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email





--
Thomas Williams
Java Programmer
Dubit Limited
+44 1133 947920
www.dubitlimited.com
LightInTheBox - Buy quality products at wholesale price