public static < S > Class < ? extends S > loadClass ( Class < S > expectedType , String serviceClassName , ClassLoader classloader ) { Class < ? > clazz = null ; Class < ? extends S > serviceClass = null ; try { clazz = classloader . loadClass ( serviceClassName ) ; serviceClass = clazz . asSubclass ( expectedType ) ; } catch ( ResourceLoadingException e ) { //noop if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loadClass()" , e ) ; } } catch ( ClassCastException e ) { //noop if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loadClass()" , e ) ; } } catch ( ClassNotFoundException e ) { //noop if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loadClass()" , e ) ; } } return serviceClass ; }
load the class and then casts to the specified sub class