use of org.talend.sdk.component.runtime.manager.reflect.parameterenricher.ConfigurationTypeParameterEnricher in project component-runtime by Talend.
the class Generator method generatedTypes.
private static void generatedTypes(final File generatedDir) throws Exception {
final File file = new File(generatedDir, "generated_configuration-types.adoc");
try (final PrintStream stream = new PrintStream(new WriteIfDifferentStream(file))) {
stream.println("");
stream.println("[role=\"table-striped table-hover table-ordered\",options=\"header,autowidth\"]");
stream.println("|====");
stream.println("|API|Type|Description|Metadata sample");
final File api = jarLocation(ConfigurationType.class);
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final ConfigurationTypeParameterEnricher enricher = new ConfigurationTypeParameterEnricher();
final Mapper mapper = new MapperBuilder().build();
final AnnotationFinder finder = new AnnotationFinder(api.isDirectory() ? new FileArchive(loader, api) : new JarArchive(loader, api.toURI().toURL()));
finder.findAnnotatedClasses(ConfigurationType.class).stream().sorted(comparing(Class::getName)).forEach(type -> stream.println("|" + type.getName() + "|" + type.getAnnotation(ConfigurationType.class).value() + "|" + extractDoc(type) + "|" + mapper.writeObjectAsString(enricher.onParameterAnnotation("value", String.class, generateAnnotation(type)))));
stream.println("|====");
stream.println();
}
}
Aggregations