private Map < Class < ? > , Object > executeBeforeBenchClass ( final Map < Class < ? > , Object > instantiatedObj , final BenchmarkResult res ) { final Map < Class < ? > , Object > returnVal = new Hashtable < Class < ? > , Object > ( ) ; // invoking before bench class for ( final Class < ? > clazz : instantiatedObj . keySet ( ) ) { final Object objectToUse = instantiatedObj . get ( clazz ) ; // ..the search for the beforeClassMeth begins... Method beforeClassMeth = null ; boolean continueVal = true ; try { beforeClassMeth = BenchmarkMethod . findAndCheckAnyMethodByAnnotation ( clazz , BeforeBenchClass . class ) ; // ... and if this search is throwing an exception, the // exception will be added and a flag is set to break up } catch ( final PerfidixMethodCheckException e ) { res . addException ( e ) ; continueVal = false ; } // if everything worked well... if ( continueVal ) { if ( beforeClassMeth == null ) { // ...either the objects is directly mapped to the class // for executing the benches returnVal . put ( clazz , objectToUse ) ; } else { // ... or the beforeMethod will be executed and a // possible exception stored to the result... final PerfidixMethodCheckException beforeByCheck = BenchmarkExecutor . checkMethod ( objectToUse , BeforeBenchClass . class , beforeClassMeth ) ; if ( beforeByCheck == null ) { final PerfidixMethodInvocationException beforeByInvok = BenchmarkExecutor . invokeMethod ( objectToUse , BeforeBenchClass . class , beforeClassMeth ) ; if ( beforeByInvok == null ) { returnVal . put ( clazz , objectToUse ) ; } else { res . addException ( beforeByInvok ) ; } } else { res . addException ( beforeByCheck ) ; } } } } return returnVal ; }
Executing beforeBenchClass if present .