Slide 31
Slide 31 text
QSPDFTTPSNPEVMF
TypeElement classElement = roundEnvironment.getElementsAnnotatedWith(MyCoolAnnotation.class)
.stream()
.filter(element -> element.getKind() == ElementKind.CLASS)
.map(element -> (TypeElement) element)
.findFirst()
.get();
String className = classElement.getSimpleName().toString();
TypeSpec typeSpec = TypeSpec.classBuilder("Sub" + className).build();
JavaFile javaFile = JavaFile.builder("com.example", typeSpec).build();
try {
javaFile.writeTo(filer);
} catch (IOException e) {
messager.printMessage(Diagnostic.Kind.ERROR, e.getMessage());
}
ΞϊςʔγϣϯʹରԠ͢Δཁૉ