Class DefaultPreparedQuery<E,RT>
java.lang.Object
io.micronaut.data.model.runtime.DefaultStoredDataOperation<RT>
io.micronaut.data.runtime.query.internal.DefaultPreparedQuery<E,RT>
- Type Parameters:
E
- The entity typeRT
- The result type
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.attr.AttributeHolder
,io.micronaut.core.naming.Named
,PagedQuery<E>
,PreparedDataOperation<RT>
,PreparedQuery<E,
,RT> StoredDataOperation<RT>
,StoredQuery<E,
,RT> DelegateStoredQuery<E,
RT>
@Internal
public final class DefaultPreparedQuery<E,RT>
extends DefaultStoredDataOperation<RT>
implements DelegateStoredQuery<E,RT>, PreparedQuery<E,RT>
Represents a prepared query.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.data.model.runtime.StoredQuery
StoredQuery.OperationType
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Constructor Summary
ConstructorDescriptionDefaultPreparedQuery
(io.micronaut.aop.MethodInvocationContext<?, ?> context, StoredQuery<E, RT> storedQuery, String finalQuery, @NonNull Pageable pageable, boolean dtoProjection, io.micronaut.core.convert.ConversionService conversionService) The default constructor. -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.core.type.Argument[]
getAttribute
(CharSequence name) <T> @NonNull Optional<T>
getAttribute
(CharSequence name, Class<T> type) @NonNull io.micronaut.core.convert.value.ConvertibleValues<Object>
io.micronaut.aop.MethodInvocationContext<?,
?> @NonNull Pageable
Object[]
<RT1> Optional<RT1>
getParameterInRole
(@NonNull String role, @NonNull Class<RT1> type) Return the value of the given parameter if the given role.@NonNull String
getQuery()
The query to execute.The parameter binding.Class<?>
The root entity type.boolean
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project.boolean
Gets an indicator telling whether underlying query is raw query.Methods inherited from class io.micronaut.data.model.runtime.DefaultStoredDataOperation
getAnnotationMetadata, getResultArgument
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
Methods inherited from interface io.micronaut.data.runtime.query.internal.DelegateStoredQuery
getAnnotationMetadata, getArgumentTypes, getEntityIdentifierType, getExpandableQueryParts, getJoinFetchPaths, getName, getOperationType, getParameterExpressions, getQueryBindings, getResultArgument, getResultDataType, getResultType, hasPageable, hasResultConsumer, isCount, isJsonEntity, isNative, isOptimisticLock, isProcedure, isSingleResult, useNumericPlaceholders
-
Constructor Details
-
DefaultPreparedQuery
public DefaultPreparedQuery(io.micronaut.aop.MethodInvocationContext<?, ?> context, StoredQuery<E, RT> storedQuery, String finalQuery, @NonNull @NonNull Pageable pageable, boolean dtoProjection, io.micronaut.core.convert.ConversionService conversionService) The default constructor.- Parameters:
context
- The execution contextstoredQuery
- The stored queryfinalQuery
- The final querypageable
- The pageabledtoProjection
- Whether the prepared query is a dto projectionconversionService
- The conversion service
-
-
Method Details
-
getContext
public io.micronaut.aop.MethodInvocationContext<?,?> getContext()- Returns:
- The context
-
getRootEntity
Description copied from interface:StoredQuery
The root entity type.- Specified by:
getRootEntity
in interfaceDelegateStoredQuery<E,
RT> - Specified by:
getRootEntity
in interfacePagedQuery<E>
- Specified by:
getRootEntity
in interfaceStoredQuery<E,
RT> - Returns:
- The root entity type
-
getQueryHints
Description copied from interface:StoredQuery
The parameter binding. That is the mapping between named query parameters and parameters of the method.- Specified by:
getQueryHints
in interfaceDelegateStoredQuery<E,
RT> - Specified by:
getQueryHints
in interfacePagedQuery<E>
- Specified by:
getQueryHints
in interfacePreparedQuery<E,
RT> - Specified by:
getQueryHints
in interfaceStoredQuery<E,
RT> - Returns:
- The parameter binding.
-
isRawQuery
public boolean isRawQuery()Description copied from interface:StoredQuery
Gets an indicator telling whether underlying query is raw query.- Specified by:
isRawQuery
in interfaceDelegateStoredQuery<E,
RT> - Specified by:
isRawQuery
in interfacePreparedQuery<E,
RT> - Specified by:
isRawQuery
in interfaceStoredQuery<E,
RT> - Returns:
- true if it is raw query
-
getStoredQueryDelegate
- Specified by:
getStoredQueryDelegate
in interfaceDelegateStoredQuery<E,
RT> - Returns:
- The delegate
-
getParameterInRole
public <RT1> Optional<RT1> getParameterInRole(@NonNull @NonNull String role, @NonNull @NonNull Class<RT1> type) Description copied from interface:PreparedDataOperation
Return the value of the given parameter if the given role.- Specified by:
getParameterInRole
in interfacePreparedDataOperation<E>
- Type Parameters:
RT1
- The generic type- Parameters:
role
- The roletype
- The type- Returns:
- An optional value.
-
getRepositoryType
- Specified by:
getRepositoryType
in interfacePreparedQuery<E,
RT> - Returns:
- The repository type.
-
getParameterArray
- Specified by:
getParameterArray
in interfacePreparedQuery<E,
RT> - Returns:
- The method parameters
-
getArguments
public io.micronaut.core.type.Argument[] getArguments()- Specified by:
getArguments
in interfacePreparedQuery<E,
RT> - Returns:
- The method arguments
-
getPageable
- Specified by:
getPageable
in interfacePagedQuery<E>
- Returns:
- The pageable object. Defaults to
Pageable.UNPAGED
-
isDtoProjection
public boolean isDtoProjection()Description copied from interface:StoredQuery
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project. Defaults to false.- Specified by:
isDtoProjection
in interfaceDelegateStoredQuery<E,
RT> - Specified by:
isDtoProjection
in interfaceStoredQuery<E,
RT> - Returns:
- Whether the query is a DTO projection query
-
getQuery
Description copied from interface:StoredQuery
The query to execute.- Specified by:
getQuery
in interfaceDelegateStoredQuery<E,
RT> - Specified by:
getQuery
in interfaceStoredQuery<E,
RT> - Returns:
- The query to execute
-
getAttributes
- Specified by:
getAttributes
in interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
- Specified by:
getAttribute
in interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
- Specified by:
getAttribute
in interfaceio.micronaut.core.attr.AttributeHolder
-