Class AbstractCriteriaMethodMatch
java.lang.Object
io.micronaut.data.processor.visitors.finders.AbstractCriteriaMethodMatch
- All Implemented Interfaces:
MethodMatcher.MethodMatch
- Direct Known Subclasses:
DeleteCriteriaMethodMatch
,QueryCriteriaMethodMatch
,UpdateCriteriaMethodMatch
public abstract class AbstractCriteriaMethodMatch
extends Object
implements MethodMatcher.MethodMatch
Abstract criteria matcher.
- Since:
- 3.2
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final record
Method result. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
-
Method Summary
Modifier and TypeMethodDescriptionprotected final AbstractCriteriaMethodMatch.MethodResult
analyzeMethodResult
(MethodMatchContext matchContext, io.micronaut.inject.ast.ClassElement queryResultType, FindersUtils.InterceptorMatch interceptorMatch, boolean allowEntityResultByDefault) protected final AbstractCriteriaMethodMatch.MethodResult
analyzeMethodResult
(MethodMatchContext matchContext, String selectedType, io.micronaut.inject.ast.ClassElement queryResultType, FindersUtils.InterceptorMatch interceptorMatch, boolean allowEntityResultByDefault) protected final void
applyJoinSpecs
(PersistentEntityRoot<?> root, @NonNull List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecs) protected <T> void
applyPredicates
(PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply a basic predicate.protected <T> void
applyPredicates
(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.protected <T> void
applyPredicates
(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.protected <T> void
applyPredicates
(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.protected <T> void
applyPredicates
(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.protected <T> void
applyPredicates
(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.protected <T> void
applyPredicates
(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.protected abstract MethodMatchInfo
build
(MethodMatchContext matchContext) final MethodMatchInfo
buildMatchInfo
(MethodMatchContext matchContext) Match info builder.protected final <T> PersistentPropertyPath<Object>
findProperty
(PersistentEntityRoot<T> root, String propertyName) protected <T> List<jakarta.persistence.criteria.Selection<?>>
findSelections
(String projectionPart, PersistentEntityRoot<T> root, PersistentEntityCriteriaBuilder cb, @Nullable String returnTypeName) Find projection selection.protected List<SourcePersistentProperty>
getDtoProjectionProperties
(SourcePersistentEntity entity, io.micronaut.inject.ast.ClassElement returnType) Find DTO properties.protected @Nullable io.micronaut.inject.ast.ParameterElement
protected @Nullable io.micronaut.inject.ast.ParameterElement
protected abstract DataMethod.OperationType
protected final <T> @NonNull jakarta.persistence.criteria.Expression<?>
getProperty
(PersistentEntityRoot<T> root, String propertyName) protected final boolean
hasNoWhereAndJoinDeclaration
(@NonNull MethodMatchContext matchContext) joinSpecsAtMatchContext
(@NonNull MethodMatchContext matchContext, boolean isQuery) protected FindersUtils.InterceptorMatch
resolveReturnTypeAndInterceptor
(MethodMatchContext matchContext) protected boolean
-
Field Details
-
matches
-
-
Constructor Details
-
AbstractCriteriaMethodMatch
-
-
Method Details
-
getEntityParameter
@Nullable protected @Nullable io.micronaut.inject.ast.ParameterElement getEntityParameter()- Returns:
- The entity parameter
-
getEntitiesParameter
@Nullable protected @Nullable io.micronaut.inject.ast.ParameterElement getEntitiesParameter()- Returns:
- The entities parameter
-
getOperationType
- Returns:
- The operation type
-
supportedByImplicitQueries
protected boolean supportedByImplicitQueries()- Returns:
- true of the operation is supported by implicit queries
-
buildMatchInfo
Description copied from interface:MethodMatcher.MethodMatch
Match info builder.- Specified by:
buildMatchInfo
in interfaceMethodMatcher.MethodMatch
- Parameters:
matchContext
- The match context- Returns:
- The match info
-
build
-
resolveReturnTypeAndInterceptor
protected FindersUtils.InterceptorMatch resolveReturnTypeAndInterceptor(MethodMatchContext matchContext) - Parameters:
matchContext
- The match context- Returns:
- resolved return type and interceptor
-
applyPredicates
protected <T> void applyPredicates(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.- Type Parameters:
T
- The entity type- Parameters:
querySequence
- The query sequenceparameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.- Type Parameters:
T
- The entity type- Parameters:
querySequence
- The query sequenceparameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates.- Type Parameters:
T
- The entity type- Parameters:
querySequence
- The query sequenceparameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.- Type Parameters:
T
- The entity type- Parameters:
parameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply a basic predicate.- Type Parameters:
T
- The entity type- Parameters:
root
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.- Type Parameters:
T
- The entity type- Parameters:
parameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
applyPredicates
protected <T> void applyPredicates(List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb) Apply predicates based on parameters.- Type Parameters:
T
- The entity type- Parameters:
parameters
- The parametersroot
- The rootquery
- The querycb
- The criteria builder
-
getProperty
@NonNull protected final <T> @NonNull jakarta.persistence.criteria.Expression<?> getProperty(PersistentEntityRoot<T> root, String propertyName) -
findProperty
@Nullable protected final <T> PersistentPropertyPath<Object> findProperty(PersistentEntityRoot<T> root, String propertyName) -
applyJoinSpecs
protected final void applyJoinSpecs(PersistentEntityRoot<?> root, @NonNull @NonNull List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecs) -
joinSpecsAtMatchContext
@NonNull protected final @NonNull List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecsAtMatchContext(@NonNull @NonNull MethodMatchContext matchContext, boolean isQuery) - Parameters:
matchContext
- The match contextisQuery
- true if is a query criteria- Returns:
- a List of annotations values for
Join
annotation.
-
hasNoWhereAndJoinDeclaration
protected final boolean hasNoWhereAndJoinDeclaration(@NonNull @NonNull MethodMatchContext matchContext) -
findSelections
protected <T> List<jakarta.persistence.criteria.Selection<?>> findSelections(String projectionPart, PersistentEntityRoot<T> root, PersistentEntityCriteriaBuilder cb, @Nullable @Nullable String returnTypeName) Find projection selection.- Type Parameters:
T
- The query type- Parameters:
projectionPart
- The projectionroot
- The rootcb
- The criteria builderreturnTypeName
- The return type name- Returns:
- The selections
-
analyzeMethodResult
protected final AbstractCriteriaMethodMatch.MethodResult analyzeMethodResult(MethodMatchContext matchContext, String selectedType, io.micronaut.inject.ast.ClassElement queryResultType, FindersUtils.InterceptorMatch interceptorMatch, boolean allowEntityResultByDefault) -
analyzeMethodResult
protected final AbstractCriteriaMethodMatch.MethodResult analyzeMethodResult(MethodMatchContext matchContext, io.micronaut.inject.ast.ClassElement queryResultType, FindersUtils.InterceptorMatch interceptorMatch, boolean allowEntityResultByDefault) -
getDtoProjectionProperties
protected List<SourcePersistentProperty> getDtoProjectionProperties(SourcePersistentEntity entity, io.micronaut.inject.ast.ClassElement returnType) Find DTO properties.- Parameters:
entity
- The entityreturnType
- The result- Returns:
- DTO properties
-