本文整理匯總了Java中javax.annotation.processing.RoundEnvironment.processingOver方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundEnvironment.processingOver方法的具體用法?Java RoundEnvironment.processingOver怎麽用?Java RoundEnvironment.processingOver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.annotation.processing.RoundEnvironment
的用法示例。
在下文中一共展示了RoundEnvironment.processingOver方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
return false;
}
for (ProcessorPipeline processorPipeline : processorPipelines) {
try {
processorPipeline.process(annotations, roundEnv);
} catch (Throwable e) {
errorReporter.reportError(
String.format(
Locale.getDefault(),
"Fatal error running %s processor: %s",
processorPipeline.getAnnotationType().getSimpleName(),
e.getMessage()));
}
}
return false;
}
示例2: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver() || written++ > 0) {
return false;
}
messager.printMessage(Diagnostic.Kind.NOTE, "writing Generated.java");
try {
Writer w = processingEnv.getFiler().createSourceFile("p.Generated").openWriter();
try {
w.write("package p; public class Generated { public static void m() { } }");
} finally {
w.close();
}
} catch (IOException x) {
messager.printMessage(Diagnostic.Kind.ERROR, x.toString());
}
return true;
}
示例3: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (!roundEnv.errorRaised() && !roundEnv.processingOver()) {
processRound(annotations, roundEnv);
}
return false;
}
示例4: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
return false;
}
Element globalConfigElement = null;
try {
globalConfigElement = prepareGlobalConfig(roundEnv);
SqlFirstApcConfig globalConfig = globalConfigElement.getAnnotation(SqlFirstApcConfig.class);
List<DaoDesc> daoDescList = processSqlSource(roundEnv, globalConfig);
if (globalConfig != null) {
prepareDaoClassImplementMap(daoDescList, roundEnv);
DaoWriter daoWriter = new DaoWriter(processingEnv);
daoWriter.write(daoDescList, globalConfig);
}
return !daoDescList.isEmpty();
} catch (RuntimeException ex) {
if (globalConfigElement == null) {
roundEnv.getElementsAnnotatedWith(SqlSource.class).forEach(x ->
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, ExceptionUtils.getFullStackTrace(ex), x)
);
} else {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, ExceptionUtils.getFullStackTrace(ex), globalConfigElement);
}
}
return false;
}
示例5: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) {
if (!round.processingOver() && !round.errorRaised()) {
processTemplates(round.getElementsAnnotatedWith(Generator.Template.class));
}
return true;
}
示例6: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
try {
LOG.log(INFO, () -> String.format("P: Processing Annotations %s (isOver=%b)", annotations, roundEnv.processingOver()));
if (roundEnv.processingOver() && !roundEnv.errorRaised()) {
LOG.info(() -> "P: processing over. Start rendering.");
new TSRenderer(processingEnv, typeScriptModel).writeFiles();
} else if (roundEnv.processingOver() && roundEnv.errorRaised()) {
LOG.info(() -> "P: processing over. error raised. nothing to do");
} else {
PROCESSING_ORDER.forEach(
(x) -> {
final Optional<? extends TypeElement> annotation = annotations
.stream()
.filter((y) -> y.getSimpleName().contentEquals(x.getSimpleName()))
.findFirst();
LOG.finest(() -> String.format("P: Annotation %s member %s", x, annotation.isPresent()));
annotation.ifPresent(typeElement -> processElements(typeElement, roundEnv));
}
);
}
} catch (Exception e) {
this.processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "internal error in jtsgen " + e);
System.err.println("FATAL error in jtsgen. Please file an issue with the following stack trace @ https://github.com/dzuvic/jtsgen/issues");
e.printStackTrace();
}
return true;
}
示例7: handleProcess
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
if (!roundEnv.processingOver()) {
generateTypeList(roundEnv);
}
return false;
}
示例8: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (!roundEnv.processingOver()) {
for (Element e : roundEnv.getElementsAnnotatedWith(RandomlyFails.class)) {
Element typeEl = e.getKind() == ElementKind.METHOD ? e.getEnclosingElement() : e;
TypeMirror nbTestCaseType = processingEnv.getElementUtils().
getTypeElement(NbTestCase.class.getName()).asType();
if (!processingEnv.getTypeUtils().isAssignable(typeEl.asType(), nbTestCaseType)) {
processingEnv.getMessager().printMessage(Kind.ERROR, "@RandomlyFails must be used on NbTestCase subclasses", e);
}
}
return true;
}
return false;
}
示例9: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver())
return true;
Trees trees = Trees.instance(processingEnv);
TypeElement testAnno = elements.getTypeElement("Check");
for (Element elem: roundEnv.getElementsAnnotatedWith(testAnno)) {
TreePath p = trees.getPath(elem);
new MulticatchParamTester(trees).scan(p, null);
}
return true;
}
示例10: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
verifyPackage(javaxLangModelPackages, javaxLangModelAcceptable);
verifyPackage(javaxToolsProcessingPackages, javaxToolsProcessingAcceptable);
verifyPackage(comSunSourcePackages, comSunSourceAcceptable);
}
return true;
}
示例11: handleProcess
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
if (roundEnv.processingOver()) {
return false;
}
for (Element element : roundEnv.getElementsAnnotatedWith(
StartupExtenderImplementation.Registration.class)) {
StartupExtenderImplementation.Registration annotation = element.getAnnotation(StartupExtenderImplementation.Registration.class);
if (annotation == null) {
continue;
}
StringBuilder builder = new StringBuilder();
for (StartMode mode : annotation.startMode()) {
builder.append(mode.name()).append(",");
}
if (builder.length() > 0) {
builder.setLength(builder.length() - 1);
}
File f = layer(element).instanceFile(PATH, null)
.instanceAttribute(DELEGATE_ATTRIBUTE, StartupExtenderImplementation.class, annotation, null)
.stringvalue(START_MODE_ATTRIBUTE, builder.toString())
.bundlevalue("displayName", element.getAnnotation(StartupExtenderImplementation.Registration.class).displayName()) // NOI18N
.methodvalue("instanceCreate", "org.netbeans.spi.extexecution.startup.StartupExtender", "createProxy") // NOI18N
.position(element.getAnnotation(StartupExtenderImplementation.Registration.class).position()); // NOI18N
f.write();
}
return true;
}
示例12: handleProcess
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
protected @Override boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
env = processingEnv;
if (roundEnv.processingOver()) {
return false;
}
for (Element e : roundEnv.getElementsAnnotatedWith(A.class)) {
layer(e).file("whatever").write();
throw new LayerGenerationException("oops");
}
return true;
}
示例13: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
processingEnv.getMessager().printMessage(Kind.ERROR, "Stop!");
}
return false;
}
示例14: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
if (!roundEnv.processingOver()) {
for (TypeElement typeElt : ElementFilter.typesIn(roundEnv.getRootElements())) {
messager.printMessage(Diagnostic.Kind.NOTE, "processing " + typeElt);
}
}
return true;
}
示例15: process
import javax.annotation.processing.RoundEnvironment; //導入方法依賴的package包/類
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
Messager messager = processingEnv.getMessager();
try {
String index = processingEnv.getOptions().get(OPTION_EVENT_BUS_INDEX);
if (index == null) {
messager.printMessage(Diagnostic.Kind.ERROR, "No option " + OPTION_EVENT_BUS_INDEX +
" passed to annotation processor");
return false;
}
verbose = Boolean.parseBoolean(processingEnv.getOptions().get(OPTION_VERBOSE));
int lastPeriod = index.lastIndexOf('.');
String indexPackage = lastPeriod != -1 ? index.substring(0, lastPeriod) : null;
round++;
if (verbose) {
messager.printMessage(Diagnostic.Kind.NOTE, "Processing round " + round + ", new annotations: " +
!annotations.isEmpty() + ", processingOver: " + env.processingOver());
}
if (env.processingOver()) {
if (!annotations.isEmpty()) {
messager.printMessage(Diagnostic.Kind.ERROR,
"Unexpected processing state: annotations still available after processing over");
return false;
}
}
if (annotations.isEmpty()) {
return false;
}
if (writerRoundDone) {
messager.printMessage(Diagnostic.Kind.ERROR,
"Unexpected processing state: annotations still available after writing.");
}
collectSubscribers(annotations, env, messager);
checkForSubscribersToSkip(messager, indexPackage);
if (!methodsByClass.isEmpty()) {
createInfoIndexFile(index);
} else {
messager.printMessage(Diagnostic.Kind.WARNING, "No @Subscribe annotations found");
}
writerRoundDone = true;
} catch (RuntimeException e) {
// IntelliJ does not handle exceptions nicely, so log and print a message
e.printStackTrace();
messager.printMessage(Diagnostic.Kind.ERROR, "Unexpected error in EventBusAnnotationProcessor: " + e);
}
return true;
}