|
|
|
@ -31,18 +31,15 @@ public class Property2JavaGenerator extends AbstractProcessor { |
|
|
|
processGenerateProperty2Java(roundEnv); |
|
|
|
processGenerateProperty2Java(roundEnv); |
|
|
|
processGenerateResourceBundleProperty2Javas(roundEnv); |
|
|
|
processGenerateResourceBundleProperty2Javas(roundEnv); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, "finished working on annotation " + annotations); |
|
|
|
"finished working on annotation " + annotations); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void processGenerateProperty2Java(RoundEnvironment roundEnv) { |
|
|
|
private void processGenerateProperty2Java(RoundEnvironment roundEnv) { |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, "Processing annotation " + GenerateProperty2Java.class); |
|
|
|
"Processing annotation " + GenerateProperty2Java.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set<? extends Element> elementsAnnotatedWith = roundEnv |
|
|
|
Set<? extends Element> elementsAnnotatedWith = roundEnv.getElementsAnnotatedWith(GenerateProperty2Java.class); |
|
|
|
.getElementsAnnotatedWith(GenerateProperty2Java.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Element element : elementsAnnotatedWith) { |
|
|
|
for (Element element : elementsAnnotatedWith) { |
|
|
|
GenerateProperty2Java generateAnnotation = element.getAnnotation(GenerateProperty2Java.class); |
|
|
|
GenerateProperty2Java generateAnnotation = element.getAnnotation(GenerateProperty2Java.class); |
|
|
|
@ -71,20 +68,15 @@ public class Property2JavaGenerator extends AbstractProcessor { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void generateElementProperties(Element element, List<String> resources, Format format) { |
|
|
|
private void generateElementProperties(Element element, List<String> resources, Format format) { |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, |
|
|
|
processingEnv.getMessager().printMessage(Kind.NOTE, "Generating Java for " + Arrays.asList(resources)); |
|
|
|
"Generating Java for " + Arrays.asList(resources)); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
ProcessorConfiguration |
|
|
|
ProcessorConfiguration.builder(processingEnv.getFiler(), element).addAll(resources).withFormat(format) |
|
|
|
.builder(processingEnv.getFiler(), element) |
|
|
|
|
|
|
|
.addAll(resources) |
|
|
|
|
|
|
|
.withFormat(format) |
|
|
|
|
|
|
|
.startGeneration(); |
|
|
|
.startGeneration(); |
|
|
|
} catch (IOException | GeneratorException e) { |
|
|
|
} catch (IOException | GeneratorException e) { |
|
|
|
StringWriter out = new StringWriter(); |
|
|
|
StringWriter out = new StringWriter(); |
|
|
|
e.printStackTrace(new PrintWriter(out)); |
|
|
|
e.printStackTrace(new PrintWriter(out)); |
|
|
|
out.flush(); |
|
|
|
out.flush(); |
|
|
|
processingEnv.getMessager().printMessage(Kind.ERROR, "Exception " + e + "\n" + out.toString(), |
|
|
|
processingEnv.getMessager().printMessage(Kind.ERROR, "Exception " + e + "\n" + out.toString(), element); |
|
|
|
element); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|