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) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringfieldNameOf(Class<?> type) Obtain the field name by type.Deprecated, for removal: This API element is subject to removal in a future version.org.springframework.javapoet.TypeNameDeprecated, for removal: This API element is subject to removal in a future version.<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 givenparameterIndexor null if the parameter cannot be determined by its index.@Nullable StringgetBindableParameterName(String parameterName) Returns the required parameter name for thebindable parameterat the given logicalparameterNameor null if the parameter cannot be determined by its name.Class<?> @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.Deprecated, for removal: This API element is subject to removal in a future version.org.springframework.javapoet.TypeNameDeprecated, for removal: This API element is subject to removal in a future version.@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)
-
-
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
-
getDomainType
- Returns:
- the repository domain type.
-
getMethodReturn
- Returns:
- the method return information.
-
getReturnedType
- Returns:
- the returned type without considering dynamic projections.
-
getActualReturnType
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the actual returned domain type.
- See Also:
-
getReturnType
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the query method return type.
- See Also:
-
getReturnTypeName
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the
TypeNamerepresenting the method return type.
-
getActualReturnTypeName
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the
TypeNamerepresenting the actual (component) 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 givenparameterIndexor null if 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 logicalparameterNameor null if 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 parameteror null if the method does not declare a sort parameter.
-
getPageableParameterName
- Returns:
- the parameter name for the
pageable parameteror null if the method does not declare a pageable parameter.
-
getLimitParameterName
- Returns:
- the parameter name for the
limit parameteror null if the method does not declare a limit parameter.
-
getScrollPositionParameterName
- Returns:
- the parameter name for the
scroll position parameteror null if the method does not declare a scroll position parameter.
-
getDynamicProjectionParameterName
- Returns:
- the parameter name for the
dynamic projection parameteror null if the method does not declare a dynamic projection parameter.
-
getVectorParameterName
- Returns:
- the parameter name for the
vector parameteror null if the method does not declare a vector type parameter.
-
getScoreParameterName
- Returns:
- the parameter name for the
score parameteror null if the method does not declare a score type parameter.
-
getScoreRangeParameterName
- Returns:
- the parameter name for the
score range parameteror null if 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.
-