Class AotQueryMethodGenerationContext
java.lang.Object
org.springframework.data.repository.aot.generate.AotQueryMethodGenerationContext
Generational AOT context for repository query method generation.
- Since:
- 4.0
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAotQueryMethodGenerationContext(RepositoryInformation repositoryInformation, Method method, QueryMethod queryMethod, AotRepositoryFragmentMetadata targetTypeMetadata) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringfieldNameOf(Class<?> type) Obtain the field name by type.<A extends Annotation>
MergedAnnotation<A> getAnnotation(Class<A> annotationType) Get the nearest matching annotation or meta-annotation of the specified type, orMergedAnnotation.missing()if none is present.@Nullable StringgetBindableParameterName(int parameterIndex) Returns the parameter name for thebindable parameterat the givenparameterIndexornullif the parameter cannot be determined by its index.@Nullable StringgetBindableParameterName(String parameterName) Returns the required parameter name for thebindable parameterat the given logicalparameterNameornullif the parameter cannot be determined by its name.@Nullable StringObtain theExpressionMarkerfor the current method.@Nullable String@Nullable MethodParametergetMethodParameter(String name) Lookup theMethodParameterby itsMethodParameter.getParameterName().@Nullable String@Nullable StringgetParameterName(int position) Returns the parameter name for the method parameter atposition.getRequiredBindableParameterName(int parameterIndex) Returns the required parameter name for thebindable parameterat the givenparameterIndexor throwsIllegalArgumentExceptionif the parameter cannot be determined by its index.getRequiredBindableParameterName(String parameterName) Returns the required parameter name for thebindable parameterat the given logicalparameterNameor throwsIllegalArgumentExceptionif the parameter cannot be determined by its name.org.springframework.javapoet.TypeName@Nullable String@Nullable String@Nullable String@Nullable String@Nullable StringlocalVariable(String variableName) Obtain a naming-clash free variant for the given logical variable name within the local method context.
-
Constructor Details
-
AotQueryMethodGenerationContext
protected AotQueryMethodGenerationContext(RepositoryInformation repositoryInformation, Method method, QueryMethod queryMethod, AotRepositoryFragmentMetadata targetTypeMetadata)
-
-
Method Details
-
getMethodParameter
Lookup theMethodParameterby itsMethodParameter.getParameterName().- Parameters:
name- the name of the parameter to look up.- Returns:
- the found method parameter or null if no parameter with the given name exists.
-
getRepositoryInformation
-
fieldNameOf
-
getMethod
-
getAnnotations
- Returns:
- the
MergedAnnotationsthat are present on the method.
-
getAnnotation
Get the nearest matching annotation or meta-annotation of the specified type, orMergedAnnotation.missing()if none is present.- Parameters:
annotationType- the annotation type to get- Returns:
- a
MergedAnnotationinstance
-
getReturnedType
- Returns:
- the returned type without considering dynamic projections.
-
getActualReturnType
- Returns:
- the actual returned domain type.
- See Also:
-
getReturnType
- Returns:
- the query method return type.
- See Also:
-
getReturnTypeName
public org.springframework.javapoet.TypeName getReturnTypeName()- Returns:
- the
TypeNamerepresenting the method return type.
-
getRequiredBindableParameterName
Returns the required parameter name for thebindable parameterat the givenparameterIndexor throwsIllegalArgumentExceptionif the parameter cannot be determined by its index.- Parameters:
parameterIndex- the zero-based parameter index as used in the query to reference bindable parameters.- Returns:
- the method parameter name.
-
getBindableParameterName
Returns the parameter name for thebindable parameterat the givenparameterIndexornullif the parameter cannot be determined by its index.- Parameters:
parameterIndex- the zero-based parameter index as used in the query to reference bindable parameters.- Returns:
- the method parameter name.
-
getRequiredBindableParameterName
Returns the required parameter name for thebindable parameterat the given logicalparameterNameor throwsIllegalArgumentExceptionif the parameter cannot be determined by its name.- Parameters:
parameterName- the parameter name as used in the query to reference bindable parameters.- Returns:
- the method parameter name.
- See Also:
-
getBindableParameterName
Returns the required parameter name for thebindable parameterat the given logicalparameterNameornullif the parameter cannot be determined by its name.- Parameters:
parameterName- the parameter name as used in the query to reference bindable parameters.- Returns:
- the method parameter name.
- See Also:
-
getBindableParameterNames
-
getAllParameterNames
-
localVariable
Obtain a naming-clash free variant for the given logical variable name within the local method context. Returns the target variable name when called multiple times with the samevariableName.- Parameters:
variableName- the logical variable name.- Returns:
- the variable name used in the generated code.
-
getParameterName
Returns the parameter name for the method parameter atposition.- Parameters:
position- zero-indexed parameter position.- Returns:
- See Also:
-
getSortParameterName
- Returns:
- the parameter name for the
sort parameterornullif the method does not declare a sort parameter.
-
getPageableParameterName
- Returns:
- the parameter name for the
pageable parameterornullif the method does not declare a pageable parameter.
-
getLimitParameterName
- Returns:
- the parameter name for the
limit parameterornullif the method does not declare a limit parameter.
-
getScrollPositionParameterName
- Returns:
- the parameter name for the
scroll position parameterornullif the method does not declare a scroll position parameter.
-
getDynamicProjectionParameterName
- Returns:
- the parameter name for the
dynamic projection parameterornullif the method does not declare a dynamic projection parameter.
-
getVectorParameterName
- Returns:
- the parameter name for the
vector parameterornullif the method does not declare a vector type parameter.
-
getScoreParameterName
- Returns:
- the parameter name for the
score parameterornullif the method does not declare a score type parameter.
-
getScoreRangeParameterName
- Returns:
- the parameter name for the
score range parameterornullif the method does not declare a score range type parameter.
-
getExpressionMarker
Obtain theExpressionMarkerfor the current method. Will add a local class within the method that can be referenced viaExpressionMarker.enclosingMethod().- Returns:
- the
ExpressionMarkerfor this particular method.
-