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()PageablegetPageable()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.StringgetQuery()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()booleanisDtoProjection()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: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
public java.util.Map<java.lang.String,java.lang.Object> 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.
-
getStoredQueryDelegate
public StoredQuery<E,RT> getStoredQueryDelegate()
- Specified by:
getStoredQueryDelegatein 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: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
public java.lang.Class<?> getRepositoryType()
- Specified by:
getRepositoryTypein interfacePreparedQuery<E,RT>- Returns:
- The repository type.
-
getParameterValues
@NonNull public java.util.Map<java.lang.String,java.lang.Object> getParameterValues()
- Specified by:
getParameterValuesin interfacePreparedQuery<E,RT>- Returns:
- The named parameter values
-
getParameterArray
public java.lang.Object[] 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
@NonNull public Pageable 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
@NonNull public java.lang.String 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
@NonNull public io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object> getAttributes()
- Specified by:
getAttributesin interfaceio.micronaut.core.attr.AttributeHolder
-
getAttribute
@NonNull public java.util.Optional<java.lang.Object> getAttribute(java.lang.CharSequence name)
- Specified by:
getAttributein 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:
getAttributein interfaceio.micronaut.core.attr.AttributeHolder
-
-