use of io.quarkus.arc.InjectableObserverMethod in project quarkus by quarkusio.
the class ArcDevRecorder method createObserversHandler.
public Handler<RoutingContext> createObserversHandler() {
return new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext ctx) {
ctx.response().putHeader("Content-Type", "application/json");
ArcContainerImpl container = ArcContainerImpl.instance();
List<InjectableObserverMethod<?>> observers = container.getObservers();
JsonArrayBuilder array = Json.array();
for (InjectableObserverMethod<?> injectableObserver : observers) {
JsonObjectBuilder observer = Json.object();
observer.put("generatedClass", injectableObserver.getClass().getName());
observer.put("observedType", injectableObserver.getObservedType().getTypeName());
if (!injectableObserver.getObservedQualifiers().isEmpty()) {
JsonArrayBuilder qualifiers = Json.array();
for (Annotation qualifier : injectableObserver.getObservedQualifiers()) {
qualifiers.add(qualifier.toString());
}
observer.put("qualifiers", qualifiers);
}
observer.put("priority", injectableObserver.getPriority());
observer.put("reception", injectableObserver.getReception().toString());
observer.put("transactionPhase", injectableObserver.getTransactionPhase().toString());
observer.put("async", injectableObserver.isAsync());
if (injectableObserver.getDeclaringBeanIdentifier() != null) {
observer.put("declaringBean", injectableObserver.getDeclaringBeanIdentifier());
}
array.add(observer);
}
ctx.response().end(array.build());
}
};
}
Aggregations