use of org.glassfish.apf.ProcessingResult in project Payara by payara.
the class AnnotationProcessorImpl method process.
/**
* Starts the annotation processing tool passing the processing context which
* encapsulate all information necessary for the configuration of the tool.
* @param ctx is the initialised processing context
* @return the result of the annotations processing
* @throws AnnotationProcessorException
*/
@Override
public ProcessingResult process(ProcessingContext ctx) throws AnnotationProcessorException {
ApplicationState state = ctx.getArchive().getExtraData(ApplicationState.class);
Optional<AnnotationProcessorState> processorState = Optional.empty();
if (state != null) {
processorState = state.getProcessingState(ctx);
}
Scanner<Object> scanner = ctx.getProcessingInput();
ProcessingResultImpl result;
errorCount = 0;
if (state == null) {
result = new ProcessingResultImpl();
for (Class c : scanner.getElements()) {
result.add(process(ctx, c));
}
} else if (state.isInactive()) {
result = new ProcessingResultImpl();
for (Class c : scanner.getElements()) {
result.add(process(ctx, c));
}
processorState.ifPresent(s -> s.setProcessingResult(result));
} else {
result = processorState.get().getProcessingResult(ProcessingResultImpl.class);
for (Class modifiedClass : scanner.getElements(state.getClassesChanged().keySet())) {
result.add(process(ctx, modifiedClass));
}
}
return result;
}
Aggregations