public static void load ( Class < ? > restrictionClass ) { if ( MASTER_CACHE == null ) { initialize ( ) ; } if ( MASTER_CACHE . isEmpty ( ) ) { return ; } Iterator < Class < ? > > iter = MASTER_CACHE . iterator ( ) ; while ( iter . hasNext ( ) ) { Class < ? > clazz = iter . next ( ) ; // Skip other classes. if ( ! restrictionClass . isAssignableFrom ( clazz ) ) { continue ; } // skip abstract / private classes. if ( Modifier . isInterface ( clazz . getModifiers ( ) ) || Modifier . isAbstract ( clazz . getModifiers ( ) ) || Modifier . isPrivate ( clazz . getModifiers ( ) ) ) { continue ; } boolean instantiable = false ; try { instantiable = clazz . getConstructor ( ) != null ; } catch ( Exception | Error e ) { // ignore } try { instantiable = instantiable || ClassGenericsUtil . getParameterizer ( clazz ) != null ; } catch ( Exception | Error e ) { // ignore } if ( ! instantiable ) { continue ; } ELKIServiceRegistry . register ( restrictionClass , clazz ) ; } }
Load classes via linear scanning .