@Test public void testLoader() { GeneratorOptions options = new GeneratorOptions(); options.generator_program_name = "loader-test"; options.program_version = "1.0"; ResourceUtils.copyResourceTo("/test.jar", tmp.getRoot()); List<GeneratorFactory> factories = loader.getFactories(tmp.getRoot()); assertThat(factories, hasSize(1)); GeneratorFactory factory = factories.get(0); assertThat(factory.generatorName(), is("js")); assertThat(factory.generatorDescription(), is("Generates JavaScript (es5.1 or es6).")); Generator generator = factory.createGenerator(new FakeFileManager(tmp.getRoot()), options, ImmutableList.of()); assertThat(generator, is(notNullValue())); }
public List<Factory> getFactories(File path) { try { List<File> jars = findJarFiles(path); List<Factory> factories = new ArrayList<>(); for (File jar : jars) { URLClassLoader classLoader = getClassLoader(jar); Factory factory = getFactory(classLoader); if (factory != null) { factories.add(factory); } } return factories; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
FactoryLoader { public List<Factory> getFactories(File path) { try { List<File> jars = findJarFiles(path); List<Factory> factories = new ArrayList<>(); for (File jar : jars) { URLClassLoader classLoader = getClassLoader(jar); Factory factory = getFactory(classLoader); if (factory != null) { factories.add(factory); } } return factories; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } }
FactoryLoader { public List<Factory> getFactories(File path) { try { List<File> jars = findJarFiles(path); List<Factory> factories = new ArrayList<>(); for (File jar : jars) { URLClassLoader classLoader = getClassLoader(jar); Factory factory = getFactory(classLoader); if (factory != null) { factories.add(factory); } } return factories; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } FactoryLoader(String manifestProperty); }
FactoryLoader { public List<Factory> getFactories(File path) { try { List<File> jars = findJarFiles(path); List<Factory> factories = new ArrayList<>(); for (File jar : jars) { URLClassLoader classLoader = getClassLoader(jar); Factory factory = getFactory(classLoader); if (factory != null) { factories.add(factory); } } return factories; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } FactoryLoader(String manifestProperty); List<Factory> getFactories(File path); Factory getFactory(File file); }
FactoryLoader { public List<Factory> getFactories(File path) { try { List<File> jars = findJarFiles(path); List<Factory> factories = new ArrayList<>(); for (File jar : jars) { URLClassLoader classLoader = getClassLoader(jar); Factory factory = getFactory(classLoader); if (factory != null) { factories.add(factory); } } return factories; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } FactoryLoader(String manifestProperty); List<Factory> getFactories(File path); Factory getFactory(File file);  }