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 Summary
-
Constructor Summary
ModifierConstructorDescriptionParameters
(Method method) Deprecated, for removal: This API element is subject to removal in a future version.protected
Parameters
(Method method, Function<MethodParameter, T> parameterFactory) Deprecated, for removal: This API element is subject to removal in a future version.protected
Parameters
(List<T> originals) Creates a newParameters
instance with the givenParameter
s put into new context.protected
Parameters
(ParametersSource parametersSource, Function<MethodParameter, T> parameterFactory) Creates a newParameters
instance for the givenMethod
andFunction
to create aParameter
instance from aMethodParameter
. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract S
createFrom
(List<T> parameters) 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, callParameters(Method, Function)
instead.getBindableParameter
(int bindableIndex) Returns a bindable parameter with the given index.Returns aParameters
instance with effectively all special parameters removed.int
Returns the index of the parameter that represents the dynamic projection type.int
int
Returns the number of parameters.int
getParameter
(int index) Returns the parameter with the given index.int
Returns the index of theScrollPosition
Method
parameter if available.int
boolean
Returns whether a parameter expressing a dynamic projection exists.boolean
Returns whether the method theParameters
was created for contains aLimit
argument.boolean
Returns whether the method theParameters
was created for contains aPageable
argument.boolean
hasParameterAt
(int position) Returns whether we have a parameter at the given position.boolean
Returns whether the method theParameters
was created for contains aScrollPosition
argument.boolean
Returns whether the method theParameters
was created for contains aSort
argument.boolean
static boolean
isBindable
(Class<?> type) Returns whether the given type is a bindable parameter.iterator()
boolean
Returns whether we potentially find aSort
parameter in the parameters.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
TYPES
-
-
Constructor Details
-
Parameters
Deprecated, for removal: This API element is subject to removal in a future version.since 3.1, useParameters(Method, Function)
instead.Creates a new instance ofParameters
.- Parameters:
method
- must not be null.
-
Parameters
@Deprecated(since="3.2.1", forRemoval=true) protected Parameters(Method method, Function<MethodParameter, T> parameterFactory) Deprecated, for removal: This API element is subject to removal in a future version.Creates a newParameters
instance for the givenMethod
andFunction
to create aParameter
instance from aMethodParameter
.- Parameters:
method
- must not be null.parameterFactory
- must not be null.- Since:
- 3.0.2
-
Parameters
protected Parameters(ParametersSource parametersSource, Function<MethodParameter, T> parameterFactory) Creates a newParameters
instance for the givenMethod
andFunction
to create aParameter
instance from aMethodParameter
.- Parameters:
parametersSource
- must not be null.parameterFactory
- must not be null.- Since:
- 3.2.1
-
Parameters
Creates a newParameters
instance with the givenParameter
s put into new context.- Parameters:
originals
-
-
-
Method Details
-
createParameter
Deprecated, for removal: This API element is subject to removal in a future version.since 3.1, in your extension, callParameters(Method, Function)
instead.Creates aParameter
instance for the givenMethodParameter
.- Parameters:
parameter
- will never be null.- Returns:
-
hasScrollPositionParameter
public boolean hasScrollPositionParameter()Returns whether the method theParameters
was created for contains aScrollPosition
argument.- Returns:
- Since:
- 3.1
-
getScrollPositionIndex
public int getScrollPositionIndex()Returns the index of theScrollPosition
Method
parameter if available. Will return -1 if there is noScrollPosition
argument in theMethod
's parameter list.- Returns:
- the scrollPositionIndex
- Since:
- 3.1
-
hasPageableParameter
public boolean hasPageableParameter()Returns whether the method theParameters
was created for contains aPageable
argument.- Returns:
-
getPageableIndex
public int getPageableIndex()Returns the index of thePageable
Method
parameter if available. Will return -1 if there is noPageable
argument in theMethod
's parameter list.- Returns:
- the pageableIndex
-
getSortIndex
public int getSortIndex()Returns the index of theSort
Method
parameter if available. Will return -1 if there is noSort
argument in theMethod
's parameter list.- Returns:
-
hasSortParameter
public boolean hasSortParameter()Returns whether the method theParameters
was created for contains aSort
argument.- Returns:
-
hasLimitParameter
public boolean hasLimitParameter()Returns whether the method theParameters
was created for contains aLimit
argument.- Returns:
- Since:
- 3.2
-
getLimitIndex
public int getLimitIndex()Returns the index of theLimit
Method
parameter if available. Will return -1 if there is noLimit
argument in theMethod
's parameter list.- Returns:
- Since:
- 3.2
-
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 aSort
parameter in the parameters.- Returns:
-
getParameter
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:
-
getNumberOfParameters
public int getNumberOfParameters()Returns the number of parameters.- Returns:
-
getBindableParameters
Returns aParameters
instance with effectively all special parameters removed.- Returns:
- See Also:
-
Parameter.TYPES
Parameter.isSpecialParameter()
-
createFrom
-
getBindableParameter
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 theString
parameter.- Parameters:
bindableIndex
-- Returns:
-
isBindable
Returns whether the given type is a bindable parameter.- Parameters:
type
-- Returns:
-
iterator
-
Parameters(Method, Function)
instead.