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
Post a Comment