jastrachan | 3 Jul 03:27 2004
Picon

Re: Minimum MetaClass override to get/set custom properties


On 29 Jun 2004, at 19:14, Andy Depue wrote:

> These are actually Java classes that I will be passing into groovy.  
> Will
> Groovy use these two methods for property access if they are in a 
> normal
> (non-groovy) Java class?

I'm fairly sure that if you write a Java class like this...

public class MyClass {
     public Object get(String name) {
	// return something
     }

     public void set(String name, Object value) {
	...
     }
}

then it'll just work.

AFAIK this works today and has done for some time - I tried to leave 
this hook inside the MetaClass in case anyone had any DynaBean type 
object or provided any Map-like random access methods.

We need to enhance the MetaClass to make it easier to map which random 
access methods should be used to lookup dynamic properties in objects.

James
-------
http://radio.weblogs.com/0112098/


Gmane