TsGenerator { public void generateJs(){ targetDir.toFile().mkdirs(); Path tsBuildDirectory; try { tsBuildDirectory = Files.createTempDirectory(""); } catch (IOException e) { throw new RuntimeException(e); } generateTs(tsBuildDirectory); writeResourceFile("tsconfig.json",tsBuildDirectory.toFile().getAbsolutePath()); compileTsToJS(tsBuildDirectory); } TsGenerator(Path targetDir, Collection<Class<? extends FactoryBase<?,R>>> dataClasses, AttributeToTsMapperManager.AttributeToTsMapperManagerCreator<R> attributeInfoMapperCreator);  TsGenerator(Path targetDir, Collection<Class<? extends FactoryBase<?,R>>> dataClasses); void clearTargetDir(); void generateTs(); void generateJs();  }
@Test @SuppressWarnings("unchecked") public void smoketest_jettyServer(@TempDir Path targetDir) { FactoryTreeBuilder<Server, TestHttpServer> builder = new FactoryTreeBuilder<>(TestHttpServer.class); builder.addBuilder(ctx-> new SimpleJettyServerBuilder<TestHttpServer>() .withHost("localhost").withPort(8005)); HashSet<Class<? extends FactoryBase<?,TestHttpServer>>> factoryClasses = new HashSet<>(); for (FactoryBase<?, TestHttpServer> factory : builder.buildTree().internal().collectChildrenDeep()) { factoryClasses.add((Class<? extends FactoryBase<?, TestHttpServer>>) factory.getClass()); factory.internal().visitAttributesFlat((attributeMetadata, attribute) -> { if (attribute instanceof FactoryAttribute){ factoryClasses.add((Class<? extends FactoryBase<?, TestHttpServer>>)attributeMetadata.referenceClass); } if (attribute instanceof FactoryListAttribute){ factoryClasses.add((Class<? extends FactoryBase<?, TestHttpServer>>)attributeMetadata.referenceClass); } }); } TsGenerator<TestHttpServer> tsClassCreator=new TsGenerator<>(targetDir, new ArrayList<>(factoryClasses)); tsClassCreator.generateJs(); }