views:

45

answers:

3

The title ask it all : How to get all property names of a Groovy class?

Is it even possible? I thought I could use collection syntaxes with classes too be it don't seem to work.

A: 

Can you use Java Reflection API?

Take a look at getDeclaredFields of java.lang.Class.

Some kind of tutorial / guide about using Reflection API.

SourceRebels
+1  A: 

According to this thread this should be possible through properties.each http://stackoverflow.com/questions/1477706/groovy-property-iteration

Martin Smith
Thanks, foo.properties was exactly what I was looking for!
Klaim
A: 

Take a look at the MetaClass API.

armandino