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.AnnotationMetadataProvider
A match context when matching methods.- Since:
- 1.0.0
- Author:
- graemerocher
-
-
Field Summary
Fields Modifier and Type Field Description protected io.micronaut.inject.ast.MethodElement
methodElement
protected io.micronaut.inject.ast.ParameterElement[]
parameters
protected io.micronaut.inject.ast.ClassElement
returnType
protected java.util.Map<java.lang.String,java.lang.String>
typeRoles
protected io.micronaut.inject.visitor.VisitorContext
visitorContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fail(java.lang.String message)
Fail compilation with the given message for the current method.io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
io.micronaut.inject.ast.MethodElement
getMethodElement()
io.micronaut.inject.ast.ParameterElement[]
getParameters()
QueryBuilder
getQueryBuilder()
io.micronaut.inject.ast.ClassElement
getRepositoryClass()
io.micronaut.inject.ast.ClassElement
getReturnType()
java.lang.String
getUnableToImplementMessage()
io.micronaut.inject.visitor.VisitorContext
getVisitorContext()
boolean
isFailing()
Is there a current error.boolean
isPossiblyFailing()
Are there possible failures.boolean
isTypeInRole(io.micronaut.inject.ast.ClassElement type, java.lang.String role)
Check whether the given type performs the given role.void
logPossibleFailures()
Log any possible failures.void
possiblyFail(java.lang.String message)
Add a message that indicates a given finder failed.boolean
supportsImplicitQueries()
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:
getAnnotationMetadata
in 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.
-
-