public <T extends RegisteredService> T getDynamicService(Package pkg, Class<T> serviceInterface, String className) {
        if (dynamicServices.containsKey(serviceInterface.getName())
                && dynamicServices.get(serviceInterface.getName()).contains(className)) {
            try {
                ClassLoader parentClassLoader = pkg == null ? getClass().getClassLoader() : pkg.getClassLoader();
                Class<?> clazz = CompiledJavaCache.getClassFromAssetName(parentClassLoader, className);
                if (clazz == null)
                    return null;
                RegisteredService rs = (RegisteredService) (clazz).newInstance();
                T drs = serviceInterface.cast(rs);
                return drs;
            }
            catch (Exception ex) {
                logger.severeException("Failed to get the dynamic registered service : " + className +" \n " + ex.getMessage(), ex);
            }
        }
        return null;
    }
public < T extends RegisteredService > T getDynamicService ( Package pkg , Class < T > serviceInterface , String className ) { if ( dynamicServices . containsKey ( serviceInterface . getName ( ) ) && dynamicServices . get ( serviceInterface . getName ( ) ) . contains ( className ) ) { try { ClassLoader parentClassLoader = pkg == null ? getClass ( ) . getClassLoader ( ) : pkg . getClassLoader ( ) ; Class < ? > clazz = CompiledJavaCache . getClassFromAssetName ( parentClassLoader , className ) ; if ( clazz == null ) return null ; RegisteredService rs = ( RegisteredService ) ( clazz ) . newInstance ( ) ; T drs = serviceInterface . cast ( rs ) ; return drs ; } catch ( Exception ex ) { logger . severeException ( "Failed to get the dynamic registered service : " + className + " \n " + ex . getMessage ( ) , ex ) ; } } return null ; }
Get the Dynamic java instance for Registered Service