コード例 #1
0
 public TerminalWriter(final JavaFileInfo javaFileInfo) {
   Preconditions.checkNotNull(javaFileInfo, "Missing 'javaFileInfo'.");
   this.javaFileInfo = javaFileInfo;
   packageName = javaFileInfo.packageName();
   terminalName = javaFileInfo.entityName();
   prime = javaFileInfo.prime();
   tag = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, terminalName);
   simpleName =
       CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, terminalName).replace('_', ' ');
   terminalTypeName = ClassName.get(packageName, terminalName);
 }
コード例 #2
0
 public void create() {
   final JavaFile javaFile =
       JavaFile.builder(packageName, createTerminalType())
           .indent("    ")
           .skipJavaLangImports(true)
           .build();
   Misc.writeJavaFile(javaFile, javaFileInfo.projectInfo().srcMainJavaDir());
   final TerminalTestWriter terminalTestWriter = new TerminalTestWriter(javaFileInfo);
   terminalTestWriter.create();
 }