use of org.talend.sdk.component.runtime.manager.reflect.parameterenricher.ConditionParameterEnricher in project component-runtime by Talend.
the class Generator method generatedConditions.
private static void generatedConditions(final File generatedDir) throws Exception {
final File file = new File(generatedDir, "generated_conditions.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|Name|Description|Metadata Sample");
final File api = jarLocation(Condition.class);
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final ConditionParameterEnricher enricher = new ConditionParameterEnricher();
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(Condition.class).stream().sorted(comparing(Class::getName)).forEach(type -> stream.println("|@" + type.getName() + "|" + type.getAnnotation(Condition.class).value() + "|" + extractDoc(type) + "|" + mapper.writeObjectAsString(enricher.onParameterAnnotation("test", String.class, generateAnnotation(type))).replace("tcomp::", "")));
stream.println("|====");
stream.println();
}
}
Aggregations