use of com.github.javaparser.printer.PrettyPrinter in project javaparser by javaparser.
the class MetaModelGenerator method main.
public static void main(String[] args) throws IOException, NoSuchMethodException {
if (args.length != 1) {
throw new RuntimeException("Need 1 parameter: the JavaParser source checkout root directory.");
}
final Path root = Paths.get(args[0], "..", "javaparser-core", "src", "main", "java");
final SourceRoot sourceRoot = new SourceRoot(root);
sourceRoot.setPrinter(new PrettyPrinter(new PrettyPrinterConfiguration().setEndOfLineCharacter("\n"))::print);
new MetaModelGenerator().run(sourceRoot);
sourceRoot.saveAll();
}
use of com.github.javaparser.printer.PrettyPrinter in project drools by kiegroup.
the class QueryGenerator method main.
public static void main(String[] args) {
int arity = 10;
CompilationUnit patternDSL = new CompilationUnit();
ClassOrInterfaceDeclaration clazzPatternDSL = patternDSL.addClass("PatternDSL");
range(arity).forEach(arity1 -> new PatternDSLQueryGenerator(clazzPatternDSL, arity1).generate());
System.out.println(new PrettyPrinter().print(clazzPatternDSL));
CompilationUnit flowDSL = new CompilationUnit();
ClassOrInterfaceDeclaration clazzFlowDSL = flowDSL.addClass("FlowDSL");
range(arity).forEach(arity1 -> new FlowDSLQueryGenerator(clazzFlowDSL, arity1).generate());
System.out.println(new PrettyPrinter().print(clazzFlowDSL));
range(arity).forEach(QueryGenerator::generateQueryDef);
range(arity).forEach(QueryGenerator::generateQueryDefImpl);
}
use of com.github.javaparser.printer.PrettyPrinter in project drools by kiegroup.
the class QueryGenerator method generateQueryDef.
private static void generateQueryDef(int arity) {
QueryDefGenerator queryDefGenerator = new QueryDefGenerator(arity);
CompilationUnit queryDef = queryDefGenerator.generate();
String generatedClass = new PrettyPrinter().print(queryDef);
try {
Path querydef = Paths.get("/tmp/", "querydef", queryDefGenerator.getClassName() + ".java");
Files.createDirectories(querydef.getParent());
Files.write(querydef, generatedClass.getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.github.javaparser.printer.PrettyPrinter in project drools by kiegroup.
the class QueryGenerator method generateQueryDefImpl.
private static void generateQueryDefImpl(int arity) {
QueryDefImplGenerator queryDefImplGenerator = new QueryDefImplGenerator(arity);
CompilationUnit queryDefImpl = queryDefImplGenerator.generate();
String generatedClass = new PrettyPrinter().print(queryDefImpl);
try {
Path queryimpl = Paths.get("/tmp/", "queryimpl", queryDefImplGenerator.getClassName() + ".java");
Files.createDirectories(queryimpl.getParent());
Files.write(queryimpl, generatedClass.getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations