T - The declaring typeR - The return typepublic abstract class AbstractQueryInterceptor<T,R> extends java.lang.Object implements DataInterceptor<T,R>
Query.| Modifier and Type | Field and Description |
|---|---|
protected RepositoryOperations |
operations |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQueryInterceptor(RepositoryOperations operations)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Number |
convertNumberArgumentIfNecessary(java.lang.Number number,
io.micronaut.core.type.Argument<?> argument)
Convert a number argument if necessary.
|
protected <E> BatchOperation<E> |
getBatchOperation(io.micronaut.aop.MethodInvocationContext context)
Get the batch operation for the given context.
|
protected <E> BatchOperation<E> |
getBatchOperation(io.micronaut.aop.MethodInvocationContext context,
java.lang.Class<E> rootEntity)
Get the batch operation for the given context.
|
protected <E> BatchOperation<E> |
getBatchOperation(io.micronaut.aop.MethodInvocationContext context,
java.lang.Class<E> rootEntity,
java.lang.Iterable<E> iterable)
Get the batch operation for the given context.
|
protected <E> BatchOperation<E> |
getBatchOperation(io.micronaut.aop.MethodInvocationContext context,
java.lang.Iterable<E> iterable)
Get the batch oepration for the given context.
|
protected <E> InsertOperation<E> |
getInsertOperation(io.micronaut.aop.MethodInvocationContext context)
Get the batch operation for the given context.
|
protected <E> InsertOperation<E> |
getInsertOperation(io.micronaut.aop.MethodInvocationContext context,
E entity)
Get the batch operation for the given context.
|
protected Pageable |
getPageable(io.micronaut.aop.MethodInvocationContext<?,?> context)
Resolves the
Pageable for the given context. |
protected <E> PagedQuery<E> |
getPagedQuery(io.micronaut.aop.MethodInvocationContext context)
Get the paged query for the given context.
|
protected java.lang.Object |
getRequiredEntity(io.micronaut.aop.MethodInvocationContext<T,?> context)
Looks up the entity to persist from the execution context, or throws an exception.
|
protected java.lang.Class<?> |
getRequiredRootEntity(io.micronaut.aop.MethodInvocationContext context)
Obtains the root entity or throws an exception if it not available.
|
protected <E> UpdateOperation<E> |
getUpdateOperation(io.micronaut.aop.MethodInvocationContext context)
Get the batch operation for the given context.
|
protected java.lang.Object |
instantiateEntity(java.lang.Class<?> rootEntity,
java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Instantiate the given entity for the given parameter values.
|
protected boolean |
isNullable(io.micronaut.core.annotation.AnnotationMetadata metadata)
Return whether the metadata indicates the instance is nullable.
|
protected PreparedQuery<?,java.lang.Number> |
prepareCountQuery(RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context)
Prepares a query for the given context.
|
protected PreparedQuery<?,?> |
prepareQuery(RepositoryMethodKey key,
io.micronaut.aop.MethodInvocationContext<T,R> context)
Prepares a query for the given context.
|
protected <RT> PreparedQuery<?,RT> |
prepareQuery(RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context,
java.lang.Class<RT> resultType)
Prepares a query for the given context.
|
protected void |
validateNullArguments(io.micronaut.aop.MethodInvocationContext<T,R> context)
Validates null arguments ensuring no argument is null unless declared so.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinterceptprotected final RepositoryOperations operations
protected AbstractQueryInterceptor(@NonNull
RepositoryOperations operations)
operations - The operationsprotected final PreparedQuery<?,?> prepareQuery(RepositoryMethodKey key, io.micronaut.aop.MethodInvocationContext<T,R> context)
key - The method keycontext - The contextprotected final <RT> PreparedQuery<?,RT> prepareQuery(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<T,R> context, java.lang.Class<RT> resultType)
RT - The result generic typemethodKey - The method keycontext - The contextresultType - The result typeprotected final PreparedQuery<?,java.lang.Number> prepareCountQuery(RepositoryMethodKey methodKey, @NonNull io.micronaut.aop.MethodInvocationContext<T,R> context)
methodKey - The method keycontext - The context@NonNull protected java.lang.Class<?> getRequiredRootEntity(io.micronaut.aop.MethodInvocationContext context)
context - The contextjava.lang.IllegalStateException - If the root entity is unavailable@NonNull protected Pageable getPageable(io.micronaut.aop.MethodInvocationContext<?,?> context)
Pageable for the given context.context - The pageableprotected boolean isNullable(@NonNull
io.micronaut.core.annotation.AnnotationMetadata metadata)
metadata - The metadata@NonNull protected java.lang.Object getRequiredEntity(io.micronaut.aop.MethodInvocationContext<T,?> context)
context - The context@NonNull
protected java.lang.Object instantiateEntity(@NonNull
java.lang.Class<?> rootEntity,
@NonNull
java.util.Map<java.lang.String,java.lang.Object> parameterValues)
rootEntity - The entityparameterValues - The parameter valuesjava.lang.IllegalArgumentException - if the entity cannot be instantiated due to an illegal argument@Nullable
protected java.lang.Number convertNumberArgumentIfNecessary(java.lang.Number number,
io.micronaut.core.type.Argument<?> argument)
number - The numberargument - The argument@NonNull protected <E> PagedQuery<E> getPagedQuery(@NonNull io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contet@NonNull protected <E> BatchOperation<E> getBatchOperation(@NonNull io.micronaut.aop.MethodInvocationContext context, @NonNull java.lang.Iterable<E> iterable)
E - The entity typecontext - The contextiterable - The iterableprotected <E> BatchOperation<E> getBatchOperation(@NonNull io.micronaut.aop.MethodInvocationContext context, java.lang.Class<E> rootEntity, @NonNull java.lang.Iterable<E> iterable)
E - The entity typecontext - The contextrootEntity - The root entityiterable - The iterable@NonNull protected <E> BatchOperation<E> getBatchOperation(@NonNull io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contextprotected <E> BatchOperation<E> getBatchOperation(@NonNull io.micronaut.aop.MethodInvocationContext context, @NonNull java.lang.Class<E> rootEntity)
E - The entity typecontext - The contextrootEntity - The root entityprotected <E> InsertOperation<E> getInsertOperation(@NonNull io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contextprotected <E> UpdateOperation<E> getUpdateOperation(@NonNull io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contextprotected <E> InsertOperation<E> getInsertOperation(@NonNull io.micronaut.aop.MethodInvocationContext context, E entity)
E - The entity typecontext - The contextentity - The entity