public static < T extends Service > Map < String , T > loadServicesByType ( Class < T > clazz ) { ServiceLoader < T > loader = ServiceLoader . load ( clazz ) ; Iterator < T > it = loader . iterator ( ) ; Map < String , T > ret = new HashMap < String , T > ( ) ; while ( it . hasNext ( ) ) { T op = it . next ( ) ; ret . put ( op . getId ( ) , op ) ; if ( op instanceof ParametrizedOperation ) addParametrizedService ( op . getId ( ) , ( ParametrizedOperation ) op ) ; if ( op instanceof ScriptObject ) addScriptObject ( ( ( ScriptObject ) op ) . getVarName ( ) , ( ScriptObject ) op ) ; } return ret ; }
Discovers the registered services of the given class .