@Test public void testLookup() { final Class clazz = org.jaitools.numeric.Processor.class; List<Class> providers = Lookup.getProviders(clazz.getName()); assertFalse(providers.isEmpty()); for (Class c : providers) { assertTrue(clazz.isAssignableFrom(c)); } }
public static List<Class> getProviders(String spiName) { List<Class> providers = null; WeakReference<List<Class>> ref = cache.get(spiName); if (ref != null) { providers = ref.get(); } if (providers == null) { providers = getProvidersFromSpiFile(spiName); cache.put(spiName, new WeakReference<List<Class>>(providers)); } return providers; }
Lookup { public static List<Class> getProviders(String spiName) { List<Class> providers = null; WeakReference<List<Class>> ref = cache.get(spiName); if (ref != null) { providers = ref.get(); } if (providers == null) { providers = getProvidersFromSpiFile(spiName); cache.put(spiName, new WeakReference<List<Class>>(providers)); } return providers; } }
Lookup { public static List<Class> getProviders(String spiName) { List<Class> providers = null; WeakReference<List<Class>> ref = cache.get(spiName); if (ref != null) { providers = ref.get(); } if (providers == null) { providers = getProvidersFromSpiFile(spiName); cache.put(spiName, new WeakReference<List<Class>>(providers)); } return providers; }  }
Lookup { public static List<Class> getProviders(String spiName) { List<Class> providers = null; WeakReference<List<Class>> ref = cache.get(spiName); if (ref != null) { providers = ref.get(); } if (providers == null) { providers = getProvidersFromSpiFile(spiName); cache.put(spiName, new WeakReference<List<Class>>(providers)); } return providers; }  static List<Class> getProviders(String spiName); static void clearCache(); static Map<String, List<Class>> getCachedProviders(); }
Lookup { public static List<Class> getProviders(String spiName) { List<Class> providers = null; WeakReference<List<Class>> ref = cache.get(spiName); if (ref != null) { providers = ref.get(); } if (providers == null) { providers = getProvidersFromSpiFile(spiName); cache.put(spiName, new WeakReference<List<Class>>(providers)); } return providers; }  static List<Class> getProviders(String spiName); static void clearCache(); static Map<String, List<Class>> getCachedProviders();  }