List<Class<?>> classes = StaticAnalyzer.analyze("source_code_folder");
List<Method> methods = new ArrayList<>();
for (Class<?> clazz : classes) {
methods.addAll(clazz.getDeclaredMethods());
}
MappingRule rule1 = new MappingRule("source_code_class", "target_code_class");
MappingRule rule2 = new MappingRule("source_code_method", "target_code_method(argument)");
MappingConfig config = new MappingConfig();
config.addRule(rule1);
config.addRule(rule2);
CodeMapper mapper = new CodeMapper(config);
for (Method method : methods) {
mapper.map(method);
}
String generatedCode = mapper.generate();
FileUtils.writeToFile("target_code_folder/TargetCode.java", generatedCode);