public Map < PluginClassLoaderDef , ClassLoader > create ( Collection < PluginClassLoaderDef > defs ) { ClassLoader baseClassLoader = baseClassLoader ( ) ; ClassloaderBuilder builder = new ClassloaderBuilder ( ) ; builder . newClassloader ( API_CLASSLOADER_KEY , baseClassLoader ) ; builder . setMask ( API_CLASSLOADER_KEY , apiMask ( ) ) ; for ( PluginClassLoaderDef def : defs ) { builder . newClassloader ( def . getBasePluginKey ( ) ) ; builder . setParent ( def . getBasePluginKey ( ) , API_CLASSLOADER_KEY , new Mask ( ) ) ; builder . setLoadingOrder ( def . getBasePluginKey ( ) , def . isSelfFirstStrategy ( ) ? SELF_FIRST : PARENT_FIRST ) ; for ( File jar : def . getFiles ( ) ) { builder . addURL ( def . getBasePluginKey ( ) , fileToUrl ( jar ) ) ; } exportResources ( def , builder , defs ) ; } return build ( defs , builder ) ; }
Creates as many classloaders as requested by the input parameter .