What's the Groovy equivalent to Python's dir()?

groovy, python

Solution

Looks particulary nice in Groovy (untested, taken from this link so code credit should go there):

// Introspection, know all the details about classes :
// List all constructors of a class
String.constructors.each{println it}

// List all interfaces implemented by a class
String.interfaces.each{println it}

// List all methods offered by a class
String.methods.each{println it}

// Just list the methods names
String.methods.name

// Get the fields of an object (with their values)
d = new Date()
d.properties.each{println it}

The general term you are looking for is introspection.

Problem

In Python I can see what methods and fields an object has with: ``` print dir(my_object) ``` What's the equivalent of that in Groovy (assuming it has one)?

Original source