jastrachan | 13 May 21:32 2004

Re: [groovy-dev] patch for Object.eachPropertyName()

On 13 May 2004, at 20:12, John Stump wrote:
> I agree with the PropertyValue class name and leaving
> properties() as a method instead of a property. I saw the
> MetaProperties class but no one seems to use it yet, so I was
> unclear what it is for.

MetaClass & MetaMethod are used extensively by the runtime (rather than 
by groovy developers directly); I kept meaning to do the same with 
MetaProperty too - and to cache them efficiently in the MetaClass to 
speed up introspection etc.

BTW the main reason for using MetaProperty rather than the JDK's 
PropertyDescriptor means we can help with situations when bean 
reflection doesn't work. e.g. its really easy to break the Java Beans 
introspector. Just have 2 setter methods for the same property name or 

Also we need to allow public fields to be accessed via a form of 
MetaProperty. e.g.


So we sometimes want to overload the inbuilt introspection rules of 
Java. So in Groovy a MetaProperty doesn't have to be implemented using 
a Java Bean PropertyDescriptor, sometimes we can code around bad-beans.

> So now I'll take a crack at it....

Great stuff! Thanks John!