Interface AfterFind<T>

Type Parameters:
T - the type of the query result (e.g., List<OrderDto> or CollectionResponse)

public interface AfterFind<T>
Hook interface invoked after the query results are returned by the proxy-api-controller interceptor.

Implement this interface and annotate the target controller method with ApiAfterFind to post-process the result before it is returned to the caller. Typical use cases include enriching DTOs with additional data, filtering sensitive fields, or triggering side effects such as audit logging.

Implementations must be Spring-managed beans (e.g., annotated with @Component) so that the framework can retrieve them from the application context at runtime.

Example


 @Component
 public class OrderEnricher implements AfterFind<List<OrderDto>> {

     @Override
     public List<OrderDto> after(List<OrderDto> result, Object... args) {
         result.forEach(o -> o.setLabel(resolveLabel(o)));
         return result;
     }
 }
 
Author:
Francesco Baldi
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    after(T result, Object... args)
    Called after the query has been executed and the result has been mapped, allowing callers to transform or enrich the response.
  • Method Details

    • after

      T after(T result, Object... args)
      Called after the query has been executed and the result has been mapped, allowing callers to transform or enrich the response.
      Parameters:
      result - the query result produced by the interceptor
      args - the original method arguments from the controller invocation
      Returns:
      the (possibly modified) result to return to the HTTP caller