public static PerfidixMethodCheckException checkMethod ( final Object obj , final Class < ? extends Annotation > anno , final Method ... meths ) { for ( Method meth : meths ) { // check if the class of the object to be executed has the given // method boolean classMethodCorr = false ; for ( final Method methodOfClass : obj . getClass ( ) . getDeclaredMethods ( ) ) { if ( methodOfClass . equals ( meth ) ) { classMethodCorr = true ; } } if ( ! classMethodCorr ) { return new PerfidixMethodCheckException ( new IllegalStateException ( "Object to execute " + obj + " is not having a Method named " + meth + "." ) , meth , anno ) ; } // check if the method is reflected executable if ( ! BenchmarkMethod . isReflectedExecutable ( meth , anno ) ) { return new PerfidixMethodCheckException ( new IllegalAccessException ( "Method to execute " + meth + " is not reflected executable." ) , meth , anno ) ; } } return null ; }
Checking a method if it is reflective executable and if the mapping to the object fits .