解决方法
看起来特别好在Groovy(未经测试,taken from this link所以代码信用应该去那里):
// 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}
你正在寻找的一般术语是内省.