@Test(expected = ClassCastException.class) public void classCastException() { List<String> services = pluginServiceFactory.createServiceObjects("service/test-services"); String bla = services.get(0); }
public <T> List<T> createServiceObjects(String... descriptorPaths) { try { ServiceEntry.initDefaultOrder(); TreeMap<ServiceEntry,T> serviceMap = new TreeMap<ServiceEntry,T>(); for (String descriptor : descriptorPaths) { readServiceDefinitions(serviceMap, descriptor); } ArrayList<T> ret = new ArrayList<T>(); for (T service : serviceMap.values()) { ret.add(service); } return ret; } finally { ServiceEntry.removeDefaultOrder(); } }
PluginServiceFactory { public <T> List<T> createServiceObjects(String... descriptorPaths) { try { ServiceEntry.initDefaultOrder(); TreeMap<ServiceEntry,T> serviceMap = new TreeMap<ServiceEntry,T>(); for (String descriptor : descriptorPaths) { readServiceDefinitions(serviceMap, descriptor); } ArrayList<T> ret = new ArrayList<T>(); for (T service : serviceMap.values()) { ret.add(service); } return ret; } finally { ServiceEntry.removeDefaultOrder(); } } }
PluginServiceFactory { public <T> List<T> createServiceObjects(String... descriptorPaths) { try { ServiceEntry.initDefaultOrder(); TreeMap<ServiceEntry,T> serviceMap = new TreeMap<ServiceEntry,T>(); for (String descriptor : descriptorPaths) { readServiceDefinitions(serviceMap, descriptor); } ArrayList<T> ret = new ArrayList<T>(); for (T service : serviceMap.values()) { ret.add(service); } return ret; } finally { ServiceEntry.removeDefaultOrder(); } } PluginServiceFactory(C context, ClassLoader ... loaders); }
PluginServiceFactory { public <T> List<T> createServiceObjects(String... descriptorPaths) { try { ServiceEntry.initDefaultOrder(); TreeMap<ServiceEntry,T> serviceMap = new TreeMap<ServiceEntry,T>(); for (String descriptor : descriptorPaths) { readServiceDefinitions(serviceMap, descriptor); } ArrayList<T> ret = new ArrayList<T>(); for (T service : serviceMap.values()) { ret.add(service); } return ret; } finally { ServiceEntry.removeDefaultOrder(); } } PluginServiceFactory(C context, ClassLoader ... loaders); List<T> createServiceObjects(String... descriptorPaths); void addAdditionalClassLoader(ClassLoader classLoader); }
PluginServiceFactory { public <T> List<T> createServiceObjects(String... descriptorPaths) { try { ServiceEntry.initDefaultOrder(); TreeMap<ServiceEntry,T> serviceMap = new TreeMap<ServiceEntry,T>(); for (String descriptor : descriptorPaths) { readServiceDefinitions(serviceMap, descriptor); } ArrayList<T> ret = new ArrayList<T>(); for (T service : serviceMap.values()) { ret.add(service); } return ret; } finally { ServiceEntry.removeDefaultOrder(); } } PluginServiceFactory(C context, ClassLoader ... loaders); List<T> createServiceObjects(String... descriptorPaths); void addAdditionalClassLoader(ClassLoader classLoader);  }