Skip to content

Commit

Permalink
feat: update abstract repository adding support to repository proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Mar 31, 2024
1 parent 6aae9dc commit bf40314
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ public abstract class AbstractRepositoryProxy<T, K> implements InvocationHandler
*/
protected abstract Object executeFindByQuery(Object instance, Method method, Object[] params);

/**
* Executes a cursor pagination query based on the method and parameters.
*
* @param instance The instance on which the method was invoked.
* @param method The method being invoked.
* @param params The parameters of the method.
* @return The result of the cursor pagination query.
*/
protected abstract Object executeCursorPagination(Object instance, Method method, Object[] params);

/**
* Executes a custom operation based on the method and parameters, allowing for parameter-based queries.
* This method is meant to handle repository methods that involve custom parameter-based logic.
Expand Down Expand Up @@ -183,6 +193,9 @@ public Object invoke(Object instance, Method method, Object[] params) throws Thr
case UPDATE -> {
return unwrapInvocationTargetException(() -> UPDATE.invoke(new AnnotationOperation.Operation(method, params, repository())));
}
case CURSOR_PAGINATION -> {
return unwrapInvocationTargetException(() -> executeCursorPagination(instance, method, params));
}
default -> {
return Void.class;
}
Expand Down

0 comments on commit bf40314

Please sign in to comment.