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 java.lang.Object implements MethodMatcher.MethodMatch
Abstract criteria matcher.- Since:
- 3.2
- Author:
- Denis Stepanov
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.regex.Matchermatcher
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCriteriaMethodMatch(java.util.regex.Matcher matcher)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T> java.lang.StringapplyForUpdate(java.lang.String querySequence, PersistentEntityCriteriaQuery<T> query)Matches for update definitions in the query sequence.protected voidapplyJoinSpecs(PersistentEntityRoot<?> root, java.util.List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecs)protected <T> voidapplyPredicates(java.lang.String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates.protected <T> voidapplyPredicates(java.lang.String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates.protected <T> voidapplyPredicates(java.lang.String querySequence, io.micronaut.inject.ast.ParameterElement[] parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates.protected <T> voidapplyPredicates(java.util.List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaDelete<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates based on parameters.protected <T> voidapplyPredicates(java.util.List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaQuery<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates based on parameters.protected <T> voidapplyPredicates(java.util.List<io.micronaut.inject.ast.ParameterElement> parameters, PersistentEntityRoot<T> root, PersistentEntityCriteriaUpdate<T> query, SourcePersistentEntityCriteriaBuilder cb)Apply predicates based on parameters.protected abstract MethodMatchInfobuild(MethodMatchContext matchContext)MethodMatchInfobuildMatchInfo(MethodMatchContext matchContext)Match info builder.protected <T> PersistentPropertyPath<java.lang.Object>findProperty(PersistentEntityRoot<T> root, java.lang.String propertyName)protected io.micronaut.inject.ast.ParameterElementgetEntitiesParameter()protected io.micronaut.inject.ast.ParameterElementgetEntityParameter()protected io.micronaut.inject.ast.ClassElementgetInterceptorElement(MethodMatchContext matchContext, java.lang.Class<? extends DataInterceptor> interceptorType)protected abstract DataMethod.OperationTypegetOperationType()protected <T> jakarta.persistence.criteria.Expression<?>getProperty(PersistentEntityRoot<T> root, java.lang.String propertyName)protected booleanhasNoWhereAndJoinDeclaration(MethodMatchContext matchContext)protected java.util.List<io.micronaut.core.annotation.AnnotationValue<Join>>joinSpecsAtMatchContext(MethodMatchContext matchContext, boolean isQuery)protected java.util.Map.Entry<io.micronaut.inject.ast.ClassElement,java.lang.Class<? extends DataInterceptor>>resolveReturnTypeAndInterceptor(MethodMatchContext matchContext)protected booleansupportedByImplicitQueries()
-
-
-
Method Detail
-
getEntityParameter
@Nullable protected io.micronaut.inject.ast.ParameterElement getEntityParameter()
- Returns:
- The entity parameter
-
getEntitiesParameter
@Nullable protected io.micronaut.inject.ast.ParameterElement getEntitiesParameter()
- Returns:
- The entities parameter
-
getOperationType
@NonNull protected abstract DataMethod.OperationType getOperationType()
- Returns:
- The operation type
-
supportedByImplicitQueries
protected boolean supportedByImplicitQueries()
- Returns:
- true of the operation is supported by implicit queries
-
buildMatchInfo
public final MethodMatchInfo buildMatchInfo(MethodMatchContext matchContext)
Description copied from interface:MethodMatcher.MethodMatchMatch info builder.- Specified by:
buildMatchInfoin interfaceMethodMatcher.MethodMatch- Parameters:
matchContext- The match context- Returns:
- The match info
-
build
protected abstract MethodMatchInfo build(MethodMatchContext matchContext)
-
getInterceptorElement
protected final io.micronaut.inject.ast.ClassElement getInterceptorElement(MethodMatchContext matchContext, java.lang.Class<? extends DataInterceptor> interceptorType)
- Parameters:
matchContext- The match contextinterceptorType- The interceptor type- Returns:
- The resolved class element
-
resolveReturnTypeAndInterceptor
protected java.util.Map.Entry<io.micronaut.inject.ast.ClassElement,java.lang.Class<? extends DataInterceptor>> resolveReturnTypeAndInterceptor(MethodMatchContext matchContext)
- Parameters:
matchContext- The match context- Returns:
- resolved return type and interceptor
-
applyPredicates
protected <T> void applyPredicates(java.lang.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(java.lang.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(java.lang.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(java.util.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(java.util.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(java.util.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
-
applyForUpdate
protected <T> java.lang.String applyForUpdate(java.lang.String querySequence, PersistentEntityCriteriaQuery<T> query)Matches for update definitions in the query sequence.- Type Parameters:
T- The entity type- Parameters:
querySequence- The query sequencequery- The query- Returns:
- The new query sequence without the for update definitions
-
getProperty
@NonNull protected final <T> jakarta.persistence.criteria.Expression<?> getProperty(PersistentEntityRoot<T> root, java.lang.String propertyName)
-
findProperty
@Nullable protected final <T> PersistentPropertyPath<java.lang.Object> findProperty(PersistentEntityRoot<T> root, java.lang.String propertyName)
-
applyJoinSpecs
protected final void applyJoinSpecs(PersistentEntityRoot<?> root, @NonNull java.util.List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecs)
-
joinSpecsAtMatchContext
@NonNull protected final java.util.List<io.micronaut.core.annotation.AnnotationValue<Join>> joinSpecsAtMatchContext(@NonNull MethodMatchContext matchContext, boolean isQuery)
- Parameters:
matchContext- The match contextisQuery- true if is a query criteria- Returns:
- a List of annotations values for annotation.
-
hasNoWhereAndJoinDeclaration
protected final boolean hasNoWhereAndJoinDeclaration(@NonNull MethodMatchContext matchContext)
-
-