static Method getPublicMethod ( Method pMethod ) { if ( pMethod == null ) { return null ; } // See if the method is already available from a public class Class cl = pMethod . getDeclaringClass ( ) ; if ( Modifier . isPublic ( cl . getModifiers ( ) ) ) { return pMethod ; } // Otherwise, try to find a public class that declares the method Method ret = getPublicMethod ( cl , pMethod ) ; if ( ret != null ) { return ret ; } else { return pMethod ; } }
Returns a publicly - accessible version of the given method by searching for a public declaring class .