Class Parameters<S extends Parameters<S,T>,T extends Parameter>

java.lang.Object
org.springframework.data.repository.query.Parameters<S,T>
All Implemented Interfaces:
Iterable<T>, Supplier<Stream<T>>, Streamable<T>
Direct Known Subclasses:
DefaultParameters

public abstract class Parameters<S extends Parameters<S,T>,T extends Parameter> extends Object implements Streamable<T>
Abstracts method parameters that have to be bound to query parameters or applied to the query independently.
Author:
Oliver Gierke, Christoph Strobl, Johannes Englmeier
  • Field Details

    • TYPES

      public static final List<Class<?>> TYPES
  • Constructor Details

  • Method Details

    • createParameter

      @Deprecated(since="3.1", forRemoval=true) protected T createParameter(MethodParameter parameter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.1, in your extension, call Parameters(Method, Function) instead.
      Creates a Parameter instance for the given MethodParameter.
      Parameters:
      parameter - will never be null.
      Returns:
    • hasScrollPositionParameter

      public boolean hasScrollPositionParameter()
      Returns whether the method the Parameters was created for contains a ScrollPosition argument.
      Returns:
      Since:
      3.1
    • getScrollPositionIndex

      public int getScrollPositionIndex()
      Returns the index of the ScrollPosition Method parameter if available. Will return -1 if there is no ScrollPosition argument in the Method's parameter list.
      Returns:
      the scrollPositionIndex
      Since:
      3.1
    • hasPageableParameter

      public boolean hasPageableParameter()
      Returns whether the method the Parameters was created for contains a Pageable argument.
      Returns:
    • getPageableIndex

      public int getPageableIndex()
      Returns the index of the Pageable Method parameter if available. Will return -1 if there is no Pageable argument in the Method's parameter list.
      Returns:
      the pageableIndex
    • getSortIndex

      public int getSortIndex()
      Returns the index of the Sort Method parameter if available. Will return -1 if there is no Sort argument in the Method's parameter list.
      Returns:
    • hasSortParameter

      public boolean hasSortParameter()
      Returns whether the method the Parameters was created for contains a Sort argument.
      Returns:
    • getDynamicProjectionIndex

      public int getDynamicProjectionIndex()
      Returns the index of the parameter that represents the dynamic projection type. Will return -1 if no such parameter exists.
      Returns:
    • hasDynamicProjection

      public boolean hasDynamicProjection()
      Returns whether a parameter expressing a dynamic projection exists.
      Returns:
    • potentiallySortsDynamically

      public boolean potentiallySortsDynamically()
      Returns whether we potentially find a Sort parameter in the parameters.
      Returns:
    • getParameter

      public T getParameter(int index)
      Returns the parameter with the given index.
      Parameters:
      index -
      Returns:
    • hasParameterAt

      public boolean hasParameterAt(int position)
      Returns whether we have a parameter at the given position.
      Parameters:
      position -
      Returns:
    • hasSpecialParameter

      public boolean hasSpecialParameter()
      Returns whether the method signature contains one of the special parameters (Pageable, Sort).
      Returns:
    • getNumberOfParameters

      public int getNumberOfParameters()
      Returns the number of parameters.
      Returns:
    • getBindableParameters

      public S getBindableParameters()
      Returns a Parameters instance with effectively all special parameters removed.
      Returns:
      See Also:
    • createFrom

      protected abstract S createFrom(List<T> parameters)
    • getBindableParameter

      public T getBindableParameter(int bindableIndex)
      Returns a bindable parameter with the given index. So for a method with a signature of (Pageable pageable, String name) a call to #getBindableParameter(0) will return the String parameter.
      Parameters:
      bindableIndex -
      Returns:
    • isBindable

      public static boolean isBindable(Class<?> type)
      Returns whether the given type is a bindable parameter.
      Parameters:
      type -
      Returns:
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<S extends Parameters<S,T>>