Grails [Groovy] How to get a list of all methods that a class has with inherited ones?
1 answer
This will give you a list of method names, filtered to include only methods belonging only to the declaration class ( SomeClass
in this example):
SomeClass sc = new SomeClass()
List<String> declaringClassOnlyMethods = sc.metaClass.methods.findAll { MetaMethod method ->
if(method.declaringClass.name == sc.class.name) {
method.name
}
}
+5
source to share