vendredi 4 novembre 2022

Reflection - Retrieve implementation information from the Functional Interface [duplicate]

I have the following class:

public class RequestInterceptorFilter implements HandlerFilterFunction<ServerResponse, ServerResponse> {

    @Override
    public Mono<ServerResponse> filter(ServerRequest request, HandlerFunction<ServerResponse> handlerFunction) {
        long startTime = System.currentTimeMillis();

        try {
            return handlerFunction.handle(request);
        } finally {
            LOGGER.debug("Executed in {}", (System.currentTimeMillis() - startTime));
        }
    }
}

In this class, the second argument of the filter method is a Functional Interface coming from the framework I have used. From the source code it is:

@FunctionalInterface
public interface HandlerFunction<T extends ServerResponse> {

    Mono<T> handle(ServerRequest request);
}

During the execution, I have placed a breakpoint in the filter method and inspected the arguments. What I can see is shown below: enter image description here I would like to retrieve the arg$1, which is UserClaimRetrievalRequestHandler@12249 within the filter method.

Is there any way I can do that?





Aucun commentaire:

Enregistrer un commentaire