private static Vector gatherMethodsRecursive(Class baseClass,String methodName,int numArgs,boolean publicOnly,Vector candidates){
  if (candidates == null)   candidates=new Vector();
  if (publicOnly) {
    if (isPublic(baseClass))     addCandidates(baseClass.getMethods(),methodName,numArgs,publicOnly,candidates);
  }
 else   addCandidates(baseClass.getDeclaredMethods(),methodName,numArgs,publicOnly,candidates);
  Class[] intfs=baseClass.getInterfaces();
  for (int i=0; i < intfs.length; i++)   gatherMethodsRecursive(intfs[i],methodName,numArgs,publicOnly,candidates);
  Class superclass=baseClass.getSuperclass();
  if (superclass != null)   gatherMethodsRecursive(superclass,methodName,numArgs,publicOnly,candidates);
  return candidates;
}

private static Vector gatherMethodsRecursive ( Class baseClass , String methodName , int numArgs , boolean publicOnly , Vector candidates ) { if ( candidates == null ) candidates = new Vector ( ) ; if ( publicOnly ) { if ( isPublic ( baseClass ) ) addCandidates ( baseClass . getMethods ( ) , methodName , numArgs , publicOnly , candidates ) ; } else addCandidates ( baseClass . getDeclaredMethods ( ) , methodName , numArgs , publicOnly , candidates ) ; Class [ ] intfs = baseClass . getInterfaces ( ) ; for ( int i = 0 ; i < intfs . length ; i ++ ) gatherMethodsRecursive ( intfs [ i ] , methodName , numArgs , publicOnly , candidates ) ; Class superclass = baseClass . getSuperclass ( ) ; if ( superclass != null ) gatherMethodsRecursive ( superclass , methodName , numArgs , publicOnly , candidates ) ; return candidates ; }
accumulate all methods , optionally including non - public methods , class and interface , in the inheritance tree of baseclass . this method is analogous to class getmethods ( ) which returns all public methods in the inheritance tree . in the normal ( non - accessible ) case this also addresses the problem that arises when a package private class or private inner class implements a public interface or derives from a public type . in other words , sometimes we ' ll find public methods that we can ' t use directly and we have to find the same public method in a parent class or interface .
