protected boolean isClassLoaded ( String className , Instrumentation instrumentation ) { if ( instrumentation == null || className == null ) { throw new IllegalArgumentException ( "instrumentation and className must not be null" ) ; } Class < ? > [ ] classes = instrumentation . getAllLoadedClasses ( ) ; for ( Class < ? > c : classes ) { if ( className . equals ( c . getName ( ) ) ) { return true ; } } return false ; }
Tests if the given class name has been loaded by the JVM . Don t use this method in case you have access to the class loader which will be loading the class because the used approach is not very efficient .