org.fisco.bcos.web3j.codegen.Generator Maven / Gradle / Ivy
package org.fisco.bcos.web3j.codegen;
import java.io.File;
import java.io.IOException;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
/**
* Common code generator methods.
*/
class Generator {
void write(String packageName, TypeSpec typeSpec, String destinationDir) throws IOException {
JavaFile javaFile = JavaFile.builder(packageName, typeSpec)
.indent(" ")
.skipJavaLangImports(true)
.build();
javaFile.writeTo(new File(destinationDir));
}
static String buildWarning(Class cls) {
return "Auto generated code.\n"
+ "Do not modifiy!\n"
+ "
Please use " + cls.getName() + " in the \n"
+ ""
+ "codegen module to update.\n";
}
}