protected static Object getImpl ( String className , Class [ ] types , Object [ ] args ) { // No tracing as this is used to load the trace factory. Object Impl ; // For return. try { Class classToInstantiate = Class . forName ( className ) ; java . lang . reflect . Constructor constructor = classToInstantiate . getDeclaredConstructor ( types ) ; constructor . setAccessible ( true ) ; Impl = constructor . newInstance ( args ) ; } catch ( Exception exception ) { // No FFDC Code Needed. // We may not have any FFDC instantiated so simply print the stack. exception . printStackTrace ( new java . io . PrintWriter ( System . out , true ) ) ; // Assume we have no chained exception support. throw new Error ( exception . toString ( ) ) ; } // catch. return Impl ; }
Create a platform specific instance of a utils class .