Grails[Groovy],How to get list of all methods a class has with out those inherited? -


i using collect methods class has:

grailsapplication.getmaincontext().getbean("classname").metaclass.methods*.name

but returns methods including inherited ones, how can filter methods owned class?

this give list of method names filtered include methods belonging declaring class(someclass in example):

someclass sc = new someclass() list<string> declaringclassonlymethods = sc.metaclass.methods.findall { metamethod method ->     if(method.declaringclass.name == sc.class.name) {         method.name     } } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

delphi - Indy UDP Read Contents of Adata -