Class AotQueryMethodGenerationContext

java.lang.Object
org.springframework.data.repository.aot.generate.AotQueryMethodGenerationContext

public class AotQueryMethodGenerationContext extends Object
Generational AOT context for repository query method generation.
Since:
4.0
Author:
Christoph Strobl, Mark Paluch
  • Constructor Details

  • Method Details

    • getMethodParameter

      public @Nullable MethodParameter getMethodParameter(String name)
      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

      public RepositoryInformation getRepositoryInformation()
    • fieldNameOf

      public @Nullable String fieldNameOf(Class<?> type)
      Obtain the field name by type.
      Parameters:
      type -
      Returns:
    • getMethod

      public Method getMethod()
    • getAnnotations

      public MergedAnnotations getAnnotations()
      Returns:
      the MergedAnnotations that are present on the method.
    • getAnnotation

      public <A extends Annotation> MergedAnnotation<A> getAnnotation(Class<A> annotationType)
      Get the nearest matching annotation or meta-annotation of the specified type, or MergedAnnotation.missing() if none is present.
      Parameters:
      annotationType - the annotation type to get
      Returns:
      a MergedAnnotation instance
    • getDomainType

      public Class<?> getDomainType()
      Returns:
      the repository domain type.
    • getMethodReturn

      public MethodReturn getMethodReturn()
      Returns:
      the method return information.
    • getReturnedType

      public ReturnedType getReturnedType()
      Returns:
      the returned type without considering dynamic projections.
    • getActualReturnType

      @Deprecated(forRemoval=true) public ResolvableType 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(forRemoval=true) public ResolvableType 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(forRemoval=true) public org.springframework.javapoet.TypeName getReturnTypeName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      the TypeName representing the method return type.
    • getActualReturnTypeName

      @Deprecated(forRemoval=true) public org.springframework.javapoet.TypeName getActualReturnTypeName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      the TypeName representing the actual (component) method return type.
    • getRequiredBindableParameterName

      public String getRequiredBindableParameterName(int parameterIndex)
      Returns the required parameter name for the bindable parameter at the given parameterIndex or throws IllegalArgumentException 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.
    • getBindableParameterName

      public @Nullable String getBindableParameterName(int parameterIndex)
      Returns the parameter name for the bindable parameter at the given parameterIndex or 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

      public String getRequiredBindableParameterName(String parameterName)
      Returns the required parameter name for the bindable parameter at the given logical parameterName or throws IllegalArgumentException 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:
    • getBindableParameterName

      public @Nullable String getBindableParameterName(String parameterName)
      Returns the required parameter name for the bindable parameter at the given logical parameterName or 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

      public List<String> getBindableParameterNames()
      Returns:
      list of bindable parameter names.
    • getAllParameterNames

      public List<String> getAllParameterNames()
      Returns:
      list of all parameter names (including non-bindable special parameters).
    • localVariable

      public String localVariable(String variableName)
      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 same variableName.
      Parameters:
      variableName - the logical variable name.
      Returns:
      the variable name used in the generated code.
    • getParameterName

      public @Nullable String getParameterName(int position)
      Returns the parameter name for the method parameter at position.
      Parameters:
      position - zero-indexed parameter position.
      Returns:
      See Also:
    • getSortParameterName

      public @Nullable String getSortParameterName()
      Returns:
      the parameter name for the sort parameter or null if the method does not declare a sort parameter.
    • getPageableParameterName

      public @Nullable String getPageableParameterName()
      Returns:
      the parameter name for the pageable parameter or null if the method does not declare a pageable parameter.
    • getLimitParameterName

      public @Nullable String getLimitParameterName()
      Returns:
      the parameter name for the limit parameter or null if the method does not declare a limit parameter.
    • getScrollPositionParameterName

      public @Nullable String getScrollPositionParameterName()
      Returns:
      the parameter name for the scroll position parameter or null if the method does not declare a scroll position parameter.
    • getDynamicProjectionParameterName

      public @Nullable String getDynamicProjectionParameterName()
      Returns:
      the parameter name for the dynamic projection parameter or null if the method does not declare a dynamic projection parameter.
    • getVectorParameterName

      public @Nullable String getVectorParameterName()
      Returns:
      the parameter name for the vector parameter or null if the method does not declare a vector type parameter.
    • getScoreParameterName

      public @Nullable String getScoreParameterName()
      Returns:
      the parameter name for the score parameter or null if the method does not declare a score type parameter.
    • getScoreRangeParameterName

      public @Nullable String getScoreRangeParameterName()
      Returns:
      the parameter name for the score range parameter or null if the method does not declare a score range type parameter.
    • getExpressionMarker

      public ExpressionMarker getExpressionMarker()
      Obtain the ExpressionMarker for the current method. Will add a local class within the method that can be referenced via ExpressionMarker.enclosingMethod().
      Returns:
      the ExpressionMarker for this particular method.