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 class io.micronaut.data.model.runtime.DefaultStoredDataOperation
NO_TRANSACTION
-
-
Constructor Summary
Constructors Constructor Description DefaultPreparedQuery(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,RT> storedQuery, java.lang.String finalQuery, Pageable pageable, boolean dtoProjection, io.micronaut.core.convert.ConversionService<?> conversionService)
The default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.micronaut.core.type.Argument[]
getArguments()
java.util.Optional<java.lang.Object>
getAttribute(java.lang.CharSequence name)
<T> java.util.Optional<T>
getAttribute(java.lang.CharSequence name, java.lang.Class<T> type)
io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object>
getAttributes()
io.micronaut.aop.MethodInvocationContext<?,?>
getContext()
Pageable
getPageable()
java.lang.Object[]
getParameterArray()
<RT1> java.util.Optional<RT1>
getParameterInRole(java.lang.String role, java.lang.Class<RT1> type)
Return the value of the given parameter if the given role.java.util.Map<java.lang.String,java.lang.Object>
getParameterValues()
java.lang.String
getQuery()
The query to execute.java.util.Map<java.lang.String,java.lang.Object>
getQueryHints()
The parameter binding.java.lang.Class<?>
getRepositoryType()
java.lang.Class<E>
getRootEntity()
The root entity type.StoredQuery<E,RT>
getStoredQueryDelegate()
boolean
isDtoProjection()
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project.-
Methods inherited from class io.micronaut.data.model.runtime.DefaultStoredDataOperation
getAnnotationMetadata, getResultArgument, getTransactionDefinition
-
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, 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, getIndexedParameterAutoPopulatedPreviousPropertyIndexes, getIndexedParameterAutoPopulatedPreviousPropertyPaths, getIndexedParameterAutoPopulatedPropertyPaths, getJoinFetchPaths, getName, getQueryBindings, getResultArgument, getResultDataType, getResultType, getTransactionDefinition, hasInExpression, hasPageable, hasResultConsumer, isCount, isNative, isOptimisticLock, isSingleResult, useNumericPlaceholders
-
Methods inherited from interface io.micronaut.data.model.runtime.PreparedQuery
getLastUpdatedType
-
Methods inherited from interface io.micronaut.data.model.runtime.StoredQuery
getIndexedParameterBinding, getIndexedParameterPaths, getIndexedParameterTypes, getLastUpdatedProperty, getParameterBinding, getParameterNames
-
-
-
-
Constructor Detail
-
DefaultPreparedQuery
public DefaultPreparedQuery(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,RT> storedQuery, java.lang.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 Detail
-
getContext
public io.micronaut.aop.MethodInvocationContext<?,?> getContext()
- Returns:
- The context
-
getRootEntity
public java.lang.Class<E> 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
public java.util.Map<java.lang.String,java.lang.Object> 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.
-
getStoredQueryDelegate
public StoredQuery<E,RT> getStoredQueryDelegate()
- Specified by:
getStoredQueryDelegate
in interfaceDelegateStoredQuery<E,RT>
- Returns:
- The delegate
-
getParameterInRole
public <RT1> java.util.Optional<RT1> getParameterInRole(@NonNull java.lang.String role, @NonNull java.lang.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
public java.lang.Class<?> getRepositoryType()
- Specified by:
getRepositoryType
in interfacePreparedQuery<E,RT>
- Returns:
- The repository type.
-
getParameterValues
@NonNull public java.util.Map<java.lang.String,java.lang.Object> getParameterValues()
- Specified by:
getParameterValues
in interfacePreparedQuery<E,RT>
- Returns:
- The named parameter values
-
getParameterArray
public java.lang.Object[] 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
@NonNull public Pageable 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
@NonNull public java.lang.String 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
@NonNull public io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object> getAttributes()
- Specified by:
getAttributes
in interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
@NonNull public java.util.Optional<java.lang.Object> getAttribute(java.lang.CharSequence name)
- Specified by:
getAttribute
in interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
@NonNull public <T> java.util.Optional<T> getAttribute(java.lang.CharSequence name, java.lang.Class<T> type)
- Specified by:
getAttribute
in interfaceio.micronaut.core.attr.AttributeHolder
-
-