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.
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPreparedQuery(io.micronaut.aop.MethodInvocationContext<?, ?> context, StoredQuery<E, RT> storedQuery, String finalQuery, 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> Optional<T>getAttribute(CharSequence name, Class<T> type) io.micronaut.core.convert.value.ConvertibleValues<Object>io.micronaut.aop.MethodInvocationContext<?,?> Object[]<RT1> Optional<RT1>getParameterInRole(String role, Class<RT1> type) Return the value of the given parameter if the given role.getQuery()The query to execute.The parameter binding.Class<?>The root entity type.booleanReturns whether the query returns the actual entity or a Data Transfer Object (DTO) project.booleanGets an indicator telling whether underlying query is raw query.Methods inherited from class io.micronaut.data.model.runtime.DefaultStoredDataOperation
getAnnotationMetadata, getResultArgument, getTransactionDefinitionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface io.micronaut.data.runtime.query.internal.DelegateStoredQuery
getAnnotationMetadata, getArgumentTypes, getEntityIdentifierType, getExpandableQueryParts, getIndexedParameterAutoPopulatedPreviousPropertyIndexes, getIndexedParameterAutoPopulatedPreviousPropertyPaths, getIndexedParameterAutoPopulatedPropertyPaths, getJoinFetchPaths, getName, getQueryBindings, getResultArgument, getResultDataType, getResultType, getTransactionDefinition, hasPageable, hasResultConsumer, isCount, isJsonEntity, isNative, isOptimisticLock, isSingleResult, useNumericPlaceholdersMethods inherited from interface io.micronaut.data.model.runtime.StoredQuery
getIndexedParameterBinding, getIndexedParameterPaths, getIndexedParameterTypes, getLastUpdatedProperty, getParameterBinding, getParameterNames, hasInExpression
-
Constructor Details
-
DefaultPreparedQuery
public DefaultPreparedQuery(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.- 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:StoredQueryThe root entity type.- Specified by:
getRootEntityin interfaceDelegateStoredQuery<E,RT> - Specified by:
getRootEntityin interfacePagedQuery<E>- Specified by:
getRootEntityin interfaceStoredQuery<E,RT> - Returns:
- The root entity type
-
getQueryHints
Description copied from interface:StoredQueryThe parameter binding. That is the mapping between named query parameters and parameters of the method.- Specified by:
getQueryHintsin interfaceDelegateStoredQuery<E,RT> - Specified by:
getQueryHintsin interfacePagedQuery<E>- Specified by:
getQueryHintsin interfacePreparedQuery<E,RT> - Specified by:
getQueryHintsin interfaceStoredQuery<E,RT> - Returns:
- The parameter binding.
-
isRawQuery
public boolean isRawQuery()Description copied from interface:StoredQueryGets an indicator telling whether underlying query is raw query.- Specified by:
isRawQueryin interfaceDelegateStoredQuery<E,RT> - Specified by:
isRawQueryin interfacePreparedQuery<E,RT> - Specified by:
isRawQueryin interfaceStoredQuery<E,RT> - Returns:
- true if it is raw query
-
getStoredQueryDelegate
- Specified by:
getStoredQueryDelegatein interfaceDelegateStoredQuery<E,RT> - Returns:
- The delegate
-
getParameterInRole
Description copied from interface:PreparedDataOperationReturn the value of the given parameter if the given role.- Specified by:
getParameterInRolein interfacePreparedDataOperation<E>- Type Parameters:
RT1- The generic type- Parameters:
role- The roletype- The type- Returns:
- An optional value.
-
getRepositoryType
- Specified by:
getRepositoryTypein interfacePreparedQuery<E,RT> - Returns:
- The repository type.
-
getParameterValues
- Specified by:
getParameterValuesin interfacePreparedQuery<E,RT> - Returns:
- The named parameter values
-
getParameterArray
- Specified by:
getParameterArrayin interfacePreparedQuery<E,RT> - Returns:
- The method parameters
-
getArguments
public io.micronaut.core.type.Argument[] getArguments()- Specified by:
getArgumentsin interfacePreparedQuery<E,RT> - Returns:
- The method arguments
-
getPageable
- Specified by:
getPageablein interfacePagedQuery<E>- Returns:
- The pageable object. Defaults to
Pageable.UNPAGED
-
isDtoProjection
public boolean isDtoProjection()Description copied from interface:StoredQueryReturns whether the query returns the actual entity or a Data Transfer Object (DTO) project. Defaults to false.- Specified by:
isDtoProjectionin interfaceDelegateStoredQuery<E,RT> - Specified by:
isDtoProjectionin interfaceStoredQuery<E,RT> - Returns:
- Whether the query is a DTO projection query
-
getQuery
Description copied from interface:StoredQueryThe query to execute.- Specified by:
getQueryin interfaceDelegateStoredQuery<E,RT> - Specified by:
getQueryin interfaceStoredQuery<E,RT> - Returns:
- The query to execute
-
getAttributes
- Specified by:
getAttributesin interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
- Specified by:
getAttributein interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
- Specified by:
getAttributein interfaceio.micronaut.core.attr.AttributeHolder
-