Skip to content

Instantly share code, notes, and snippets.

@babedev
Last active January 5, 2017 08:32
Show Gist options
  • Save babedev/c4827ba1b57da02240941d0727207bf8 to your computer and use it in GitHub Desktop.
Save babedev/c4827ba1b57da02240941d0727207bf8 to your computer and use it in GitHub Desktop.
private void generatePresenter() throws IOException {
MethodSpec attachView = MethodSpec.methodBuilder("attachView")
.addJavadoc(CodeBlock.of("Attach View"))
.addParameter(getViewType(), "view")
.addStatement("mView = view")
.build();
TypeSpec mvpPresenter = TypeSpec.classBuilder(featureName + "Presenter")
.addMethod(attachView)
.addField(getViewType(), "mView", Modifier.PRIVATE)
.build();
JavaFile javaFile = JavaFile.builder(packageName + "." + featureName.toLowerCase(), mvpPresenter)
.build();
File file = new File("app/src/main/java");
javaFile.writeTo(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment