Search in sources :

Example 1 with InjectableObserverMethod

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());
        }
    };
}
Also used : RoutingContext(io.vertx.ext.web.RoutingContext) ArcContainerImpl(io.quarkus.arc.impl.ArcContainerImpl) InjectableObserverMethod(io.quarkus.arc.InjectableObserverMethod) DevConsolePostHandler(io.quarkus.devconsole.runtime.spi.DevConsolePostHandler) Handler(io.vertx.core.Handler) JsonArrayBuilder(io.quarkus.vertx.http.runtime.devmode.Json.JsonArrayBuilder) JsonObjectBuilder(io.quarkus.vertx.http.runtime.devmode.Json.JsonObjectBuilder) Annotation(java.lang.annotation.Annotation)

Aggregations

InjectableObserverMethod (io.quarkus.arc.InjectableObserverMethod)1 ArcContainerImpl (io.quarkus.arc.impl.ArcContainerImpl)1 DevConsolePostHandler (io.quarkus.devconsole.runtime.spi.DevConsolePostHandler)1 JsonArrayBuilder (io.quarkus.vertx.http.runtime.devmode.Json.JsonArrayBuilder)1 JsonObjectBuilder (io.quarkus.vertx.http.runtime.devmode.Json.JsonObjectBuilder)1 Handler (io.vertx.core.Handler)1 RoutingContext (io.vertx.ext.web.RoutingContext)1 Annotation (java.lang.annotation.Annotation)1