@Test public void testSPI() { HmilyTestSPI hmilyTestSPI = ExtensionLoaderFactory.load(HmilyTestSPI.class); assertThat(hmilyTestSPI.getClass().getName(), is(NoHelloTestSPI.class.getName())); HmilyTestSPI test2 = ExtensionLoaderFactory.load(HmilyTestSPI.class); assertThat(test2.getClass().getName(), is(NoHelloTestSPI.class.getName())); HmilyTestSPI hello1 = ExtensionLoaderFactory.load(HmilyTestSPI.class, "hello"); assertThat(hello1.getClass().getName(), is(HelloWorldTestSPI.class.getName())); HmilyTestSPI hello2 = ExtensionLoaderFactory.load(HmilyTestSPI.class, "hello"); assertThat(hello1.getClass().getName(), is(hello2.getClass().getName())); assertEquals(hello1, hello2); HmilyTestSPI no1 = ExtensionLoaderFactory.load(HmilyTestSPI.class, "no"); assertThat(no1.getClass().getName(), is(NoHelloTestSPI.class.getName())); HmilyTestSPI no2 = ExtensionLoaderFactory.load(HmilyTestSPI.class, "no"); assertNotEquals(no1, no2); }
public static <T> T load(final Class<T> service) { return ExtensionLoader.getExtensionLoader(service).load(findClassLoader()); }
ExtensionLoaderFactory { public static <T> T load(final Class<T> service) { return ExtensionLoader.getExtensionLoader(service).load(findClassLoader()); } }
ExtensionLoaderFactory { public static <T> T load(final Class<T> service) { return ExtensionLoader.getExtensionLoader(service).load(findClassLoader()); }  }
ExtensionLoaderFactory { public static <T> T load(final Class<T> service) { return ExtensionLoader.getExtensionLoader(service).load(findClassLoader()); }  static T load(final Class<T> service); static T load(final Class<T> service, final String name); static T load(final Class<T> service, final ClassLoader loader); static T load(final Class<T> service, final String name, final ClassLoader loader); static T load(final Class<T> service, final String name, final Object[] args); static T load(final Class<T> service, final String name, final Class<?>[] argsType, final Object[] args); static List<T> loadAll(final Class<T> service); }
ExtensionLoaderFactory { public static <T> T load(final Class<T> service) { return ExtensionLoader.getExtensionLoader(service).load(findClassLoader()); }  static T load(final Class<T> service); static T load(final Class<T> service, final String name); static T load(final Class<T> service, final ClassLoader loader); static T load(final Class<T> service, final String name, final ClassLoader loader); static T load(final Class<T> service, final String name, final Object[] args); static T load(final Class<T> service, final String name, final Class<?>[] argsType, final Object[] args); static List<T> loadAll(final Class<T> service);  }