清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
if (args) {
def className = args[0]
def theClass = Class.forName(className)
def theMetaClass = theClass.metaClass
def printClass = { property ->
println "The $property of $className:"
if (theClass.class.metaClass.hasProperty(theClass, property))
theClass."$property".each { println it }
else if (theMetaClass.metaClass.hasProperty(theMetaClass, property))
theMetaClass."$property".each { println it }
}
if (args.size() == 1)
args = ['methods', 'metaMethods', 'constructors']
else
args = args[1..-1]
args.eachWithIndex { arg, index ->
if (index > 0)
println()
printClass(arg)
}
} else {
println 'Print out the informations of the specified class.'
println 'Usage: PrintClass class-full-name [methods] [metaMethods] [constructors]'
}