Interface BeforeFind<E,ID>

Type Parameters:
E - the JPA entity type
ID - the primary-key type of the entity

public interface BeforeFind<E,ID>
Hook interface invoked before the query is executed by the proxy-api-controller interceptor.

Implement this interface and annotate the target controller method with ApiBeforeFind to intercept and enrich the BaseQueryParameter before it is sent to the JpaService. Typical use cases include injecting tenant context, adding security constraints, or pre-populating filter values.

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 TenantInjector implements BeforeFind<Order, Long> {

     @Override
     public void before(BaseQueryParameter<Order, Long> parameters, Object... args) {
         parameters.addParameter("tenantId", TenantContext.current());
     }
 }
 
Author:
Francesco Baldi
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    before(BaseQueryParameter<E,ID> parameters, Object... args)
    Called before the query is executed, allowing callers to enrich or modify the query parameters.
  • Method Details

    • before

      void before(BaseQueryParameter<E,ID> parameters, Object... args)
      Called before the query is executed, allowing callers to enrich or modify the query parameters.
      Parameters:
      parameters - the query parameter object that will be passed to the service
      args - the original method arguments from the controller invocation