views:

79

answers:

1

Let's say I have a java.util.Properties object. The Properties object has a method called setProperty(String name,String value). Is there a setter shortcut for it?

EDIT: maybe the Properties class was not the best example, because I think it handles that by adding the keys as properties. But how about a setter method that takes an arbitrary number of parameters?

+2  A: 

The short answer is 'no'. Groovy only provides shortcuts for getters/setters properties which follow the JavaBeans convention

T getX()

void setX(T value)

where X is the name of the property and T is the type of the property. Methods that are named "set*" and have more than one argument do not qualify.

Don