Package com.bld.proxy.api.find
Interface BeforeFind<E,ID>
- Type Parameters:
E- the JPA entity typeID- 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 TypeMethodDescriptionvoidbefore(BaseQueryParameter<E, ID> parameters, Object... args) Called before the query is executed, allowing callers to enrich or modify the query parameters.
-
Method Details
-
before
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 serviceargs- the original method arguments from the controller invocation
-