public static Object instantiateObject ( String className , ClassLoader classLoader ) { Object object ; try { object = loadClass ( className , classLoader ) . newInstance ( ) ; } catch ( Throwable e ) { throw new RuntimeException ( "Unable to instantiate object for class '" + className + "'" , e ) ; } return object ; }
This method will attempt to create an instance of the specified Class . It uses a syncrhonized HashMap to cache the reflection Class lookup .