Class MatchContext
- java.lang.Object
-
- io.micronaut.data.processor.visitors.MatchContext
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider,io.micronaut.core.annotation.AnnotationSource
- Direct Known Subclasses:
MethodMatchContext
public class MatchContext extends java.lang.Object implements io.micronaut.core.annotation.AnnotationMetadataProviderA match context when matching methods.- Since:
- 1.0.0
- Author:
- graemerocher
-
-
Field Summary
Fields Modifier and Type Field Description protected io.micronaut.inject.ast.MethodElementmethodElementprotected io.micronaut.inject.ast.ParameterElement[]parametersprotected io.micronaut.inject.ast.ClassElementreturnTypeprotected java.util.Map<java.lang.String,java.lang.String>typeRolesprotected io.micronaut.inject.visitor.VisitorContextvisitorContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfail(java.lang.String message)Fail compilation with the given message for the current method.io.micronaut.core.annotation.AnnotationMetadatagetAnnotationMetadata()io.micronaut.inject.ast.MethodElementgetMethodElement()io.micronaut.inject.ast.ParameterElement[]getParameters()QueryBuildergetQueryBuilder()io.micronaut.inject.ast.ClassElementgetRepositoryClass()io.micronaut.inject.ast.ClassElementgetReturnType()java.lang.StringgetUnableToImplementMessage()io.micronaut.inject.visitor.VisitorContextgetVisitorContext()booleanisFailing()Is there a current error.booleanisPossiblyFailing()Are there possible failures.booleanisTypeInRole(io.micronaut.inject.ast.ClassElement type, java.lang.String role)Check whether the given type performs the given role.voidlogPossibleFailures()Log any possible failures.voidpossiblyFail(java.lang.String message)Add a message that indicates a given finder failed.booleansupportsImplicitQueries()Whether or not implicit queries such as lookup by id and counting is supported without an explicit query.-
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
-
-
-
-
Field Detail
-
visitorContext
@NonNull protected final io.micronaut.inject.visitor.VisitorContext visitorContext
-
methodElement
@NonNull protected final io.micronaut.inject.ast.MethodElement methodElement
-
typeRoles
protected final java.util.Map<java.lang.String,java.lang.String> typeRoles
-
returnType
protected final io.micronaut.inject.ast.ClassElement returnType
-
parameters
@NonNull protected final io.micronaut.inject.ast.ParameterElement[] parameters
-
-
Method Detail
-
getQueryBuilder
public QueryBuilder getQueryBuilder()
- Returns:
- The active query builder
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadatain interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
isTypeInRole
public boolean isTypeInRole(@NonNull io.micronaut.inject.ast.ClassElement type, @NonNull java.lang.String role)Check whether the given type performs the given role.- Parameters:
type- The typerole- The role- Returns:
- True if it is
-
getVisitorContext
@NonNull public io.micronaut.inject.visitor.VisitorContext getVisitorContext()
- Returns:
- The visitor context
-
getMethodElement
@NonNull public io.micronaut.inject.ast.MethodElement getMethodElement()
- Returns:
- The method element
-
getReturnType
@NonNull public io.micronaut.inject.ast.ClassElement getReturnType()
- Returns:
- The return type
-
getParameters
@NonNull public io.micronaut.inject.ast.ParameterElement[] getParameters()
- Returns:
- The parameters
-
fail
public void fail(@NonNull java.lang.String message)Fail compilation with the given message for the current method.- Parameters:
message- The message
-
possiblyFail
public void possiblyFail(@NonNull java.lang.String message)Add a message that indicates a given finder failed. This should only be used if a finder matches a method, but some additional requirement is not met. This leaves the possibility that another finder may match the method and proceed successfully. Possible failures will only be logged if the method could not be implemented.- Parameters:
message- The message
-
isFailing
public boolean isFailing()
Is there a current error.- Returns:
- True if there is an error
-
isPossiblyFailing
public boolean isPossiblyFailing()
Are there possible failures.- Returns:
- True if there is an error
-
logPossibleFailures
public void logPossibleFailures()
Log any possible failures.
-
supportsImplicitQueries
public boolean supportsImplicitQueries()
Whether or not implicit queries such as lookup by id and counting is supported without an explicit query.- Returns:
- True if it is
-
getRepositoryClass
@NonNull public io.micronaut.inject.ast.ClassElement getRepositoryClass()
- Returns:
- The repository class.
-
getUnableToImplementMessage
public java.lang.String getUnableToImplementMessage()
- Returns:
- The message to print in the case of no possible implementations.
-
-