T - The declaring typeR - The return typepublic abstract class AbstractQueryInterceptor<T,R>
extends java.lang.Object
implements io.micronaut.data.intercept.DataInterceptor<T,R>
Query.| Modifier and Type | Field and Description |
|---|---|
protected io.micronaut.data.operations.RepositoryOperations |
operations |
protected PreparedQueryResolver |
preparedQueryResolver |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQueryInterceptor(io.micronaut.data.operations.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)
Deprecated.
|
protected java.lang.Object |
convertOne(io.micronaut.aop.MethodInvocationContext<?,?> context,
java.lang.Object o) |
protected int |
count(java.lang.Iterable<?> iterable)
Count the items.
|
protected <RT> java.util.Optional<java.lang.Iterable<RT>> |
findEntitiesParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
java.lang.Class<RT> type)
Fid an entities parameter value in role.
|
protected <RT> java.util.Optional<RT> |
findEntityParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
java.lang.Class<RT> type)
Find an entity parameter value in role.
|
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> |
getDeleteAllBatchOperation(io.micronaut.aop.MethodInvocationContext<T,?> context)
Get the delete all batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> |
getDeleteBatchOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
java.lang.Class<E> rootEntity,
java.lang.Iterable<E> iterable)
Get the delete batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> |
getDeleteBatchOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
java.lang.Iterable<E> iterable)
Get the delete batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.DeleteOperation<E> |
getDeleteOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
E entity)
Get the delete operation for the given context.
|
protected <RT> java.lang.Iterable<RT> |
getEntitiesParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
java.lang.Class<RT> type)
Retrieve an entities parameter value in role.
|
protected <RT> RT |
getEntityParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
java.lang.Class<RT> type)
Retrieve an entity parameter value in role.
|
protected <E> io.micronaut.data.model.runtime.InsertBatchOperation<E> |
getInsertBatchOperation(io.micronaut.aop.MethodInvocationContext context,
java.lang.Class<E> rootEntity,
java.lang.Iterable<E> iterable)
Get the insert batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.InsertBatchOperation<E> |
getInsertBatchOperation(io.micronaut.aop.MethodInvocationContext context,
java.lang.Iterable<E> iterable)
Get the insert batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.InsertOperation<E> |
getInsertOperation(io.micronaut.aop.MethodInvocationContext context)
Get the batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.InsertOperation<E> |
getInsertOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
E entity)
Get the batch operation for the given context.
|
protected io.micronaut.data.model.Pageable |
getPageable(io.micronaut.aop.MethodInvocationContext<?,?> context)
Resolves the
Pageable for the given context. |
protected <E> io.micronaut.data.model.runtime.PagedQuery<E> |
getPagedQuery(io.micronaut.aop.MethodInvocationContext context)
Get the paged query for the given context.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getParameterValueMap(io.micronaut.aop.MethodInvocationContext<?,?> context)
Returns parameter values with respect of
Parameter annotation. |
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 <E> java.lang.Class<E> |
getRequiredRootEntity(io.micronaut.aop.MethodInvocationContext context)
Obtains the root entity or throws an exception if it not available.
|
protected io.micronaut.core.type.Argument<?> |
getReturnType(io.micronaut.aop.MethodInvocationContext<?,?> context)
Returns the return type.
|
protected <E> io.micronaut.data.model.runtime.UpdateBatchOperation<E> |
getUpdateAllBatchOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
java.lang.Class<E> rootEntity,
java.lang.Iterable<E> iterable)
Get the update all batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.UpdateOperation<E> |
getUpdateOperation(io.micronaut.aop.MethodInvocationContext<T,?> context)
Get the batch operation for the given context.
|
protected <E> io.micronaut.data.model.runtime.UpdateOperation<E> |
getUpdateOperation(io.micronaut.aop.MethodInvocationContext<T,?> context,
E entity)
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 boolean |
isNumber(java.lang.Class<?> type)
Is the type a number.
|
protected io.micronaut.data.model.runtime.PreparedQuery<?,java.lang.Number> |
prepareCountQuery(io.micronaut.data.intercept.RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context)
Prepares a query for the given context.
|
protected io.micronaut.data.model.runtime.PreparedQuery<?,?> |
prepareQuery(io.micronaut.data.intercept.RepositoryMethodKey key,
io.micronaut.aop.MethodInvocationContext<T,R> context)
Prepares a query for the given context.
|
protected <RT> io.micronaut.data.model.runtime.PreparedQuery<?,RT> |
prepareQuery(io.micronaut.data.intercept.RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context,
java.lang.Class<RT> resultType)
Prepares a query for the given context.
|
protected <RT> io.micronaut.data.model.runtime.PreparedQuery<?,RT> |
prepareQuery(io.micronaut.data.intercept.RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context,
java.lang.Class<RT> resultType,
boolean isCount)
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.
|
protected final io.micronaut.data.operations.RepositoryOperations operations
protected final PreparedQueryResolver preparedQueryResolver
protected AbstractQueryInterceptor(@NonNull
io.micronaut.data.operations.RepositoryOperations operations)
operations - The operationsprotected java.util.Map<java.lang.String,java.lang.Object> getParameterValueMap(io.micronaut.aop.MethodInvocationContext<?,?> context)
Parameter annotation.context - The method invocation contextprotected io.micronaut.core.type.Argument<?> getReturnType(io.micronaut.aop.MethodInvocationContext<?,?> context)
context - The context@Nullable
protected final java.lang.Object convertOne(io.micronaut.aop.MethodInvocationContext<?,?> context,
@Nullable
java.lang.Object o)
protected final io.micronaut.data.model.runtime.PreparedQuery<?,?> prepareQuery(io.micronaut.data.intercept.RepositoryMethodKey key,
io.micronaut.aop.MethodInvocationContext<T,R> context)
key - The method keycontext - The contextprotected final <RT> io.micronaut.data.model.runtime.PreparedQuery<?,RT> prepareQuery(io.micronaut.data.intercept.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 <RT> io.micronaut.data.model.runtime.PreparedQuery<?,RT> prepareQuery(io.micronaut.data.intercept.RepositoryMethodKey methodKey,
io.micronaut.aop.MethodInvocationContext<T,R> context,
java.lang.Class<RT> resultType,
boolean isCount)
RT - The result generic typemethodKey - The method keycontext - The contextresultType - The result typeisCount - Is count queryprotected final io.micronaut.data.model.runtime.PreparedQuery<?,java.lang.Number> prepareCountQuery(io.micronaut.data.intercept.RepositoryMethodKey methodKey,
@NonNull
io.micronaut.aop.MethodInvocationContext<T,R> context)
methodKey - The method keycontext - The context@NonNull protected <E> java.lang.Class<E> getRequiredRootEntity(io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contextjava.lang.IllegalStateException - If the root entity is unavailableprotected <RT> RT getEntityParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
@NonNull
java.lang.Class<RT> type)
RT - The generic typecontext - The contexttype - The typeprotected <RT> java.lang.Iterable<RT> getEntitiesParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
@NonNull
java.lang.Class<RT> type)
RT - The generic typecontext - The contexttype - The typeprotected <RT> java.util.Optional<RT> findEntityParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
@NonNull
java.lang.Class<RT> type)
RT - The generic typecontext - The contexttype - The typeprotected <RT> java.util.Optional<java.lang.Iterable<RT>> findEntitiesParameter(io.micronaut.aop.MethodInvocationContext<?,?> context,
@NonNull
java.lang.Class<RT> type)
RT - The generic typecontext - The contexttype - The type@NonNull protected io.micronaut.data.model.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@Deprecated
@Nullable
protected java.lang.Number convertNumberArgumentIfNecessary(java.lang.Number number,
io.micronaut.core.type.Argument<?> argument)
number - The numberargument - The argument@NonNull
protected <E> io.micronaut.data.model.runtime.PagedQuery<E> getPagedQuery(@NonNull
io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The context@NonNull
protected <E> io.micronaut.data.model.runtime.InsertBatchOperation<E> getInsertBatchOperation(@NonNull
io.micronaut.aop.MethodInvocationContext context,
@NonNull
java.lang.Iterable<E> iterable)
E - The entity typecontext - The contextiterable - The iterable@NonNull
protected <E> io.micronaut.data.model.runtime.InsertBatchOperation<E> getInsertBatchOperation(@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 iterableprotected <E> io.micronaut.data.model.runtime.InsertOperation<E> getInsertOperation(@NonNull
io.micronaut.aop.MethodInvocationContext context)
E - The entity typecontext - The contextprotected <E> io.micronaut.data.model.runtime.UpdateOperation<E> getUpdateOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context)
E - The entity typecontext - The contextprotected <E> io.micronaut.data.model.runtime.UpdateOperation<E> getUpdateOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
E entity)
E - The entity typecontext - The contextentity - The entity instance@NonNull
protected <E> io.micronaut.data.model.runtime.UpdateBatchOperation<E> getUpdateAllBatchOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
java.lang.Class<E> rootEntity,
@NonNull
java.lang.Iterable<E> iterable)
E - The entity typerootEntity - The root entitrycontext - The contextiterable - The iterableprotected <E> io.micronaut.data.model.runtime.DeleteOperation<E> getDeleteOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
@NonNull
E entity)
E - The entity typecontext - The contextentity - The entity@NonNull
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> getDeleteAllBatchOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context)
E - The entity typecontext - The context@NonNull
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> getDeleteBatchOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
@NonNull
java.lang.Iterable<E> iterable)
E - The entity typecontext - The contextiterable - The iterable@NonNull
protected <E> io.micronaut.data.model.runtime.DeleteBatchOperation<E> getDeleteBatchOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
java.lang.Class<E> rootEntity,
@NonNull
java.lang.Iterable<E> iterable)
E - The entity typecontext - The contextrootEntity - The root entityiterable - The iterableprotected <E> io.micronaut.data.model.runtime.InsertOperation<E> getInsertOperation(@NonNull
io.micronaut.aop.MethodInvocationContext<T,?> context,
E entity)
E - The entity typecontext - The contextentity - The entityprotected final void validateNullArguments(io.micronaut.aop.MethodInvocationContext<T,R> context)
context - The contextprotected int count(java.lang.Iterable<?> iterable)
iterable - the iterableprotected boolean isNumber(@Nullable
java.lang.Class<?> type)
type - The type