reflection - Printing out variables and values in a Groovy object -


How can I print (public and internal) variables and their values ​​of a Groovy object?

Ie

  square X {def X = 10 def Y = 5 private zero doPrivate () {defZ = 3}}  
< P>

  x, 10y, 5th, 3  

This should be a dynamic solution, i.e. runtime.

dump ()

For example < / P>

  "ddd" .dump ()  

print:

java.lang.String@2ef900 value = dddd offset = 0 calculation = 4 hash = 3078400


Comments