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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParameters(List<T> originals) Creates a newParametersinstance with the givenParameters put into new context.protectedParameters(ParametersSource parametersSource, Function<MethodParameter, T> parameterFactory) Creates a newParametersinstance for the givenMethodandFunctionto create aParameterinstance from aMethodParameter. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ScreateFrom(List<T> parameters) getBindableParameter(int bindableIndex) Returns a bindable parameter with the given index.Returns aParametersinstance with effectively all special parameters removed.intReturns the index of the parameter that represents the dynamic projection type.intintReturns the number of parameters.intgetParameter(int index) Returns the parameter with the given index.intReturns the index of theScoreargument.intintReturns the index of theScrollPositionMethodparameter if available.intintReturns the index of theVectorargument.booleanReturns whether a parameter expressing a dynamic projection exists.booleanReturns whether the method theParameterswas created for contains aLimitargument.booleanReturns whether the method theParameterswas created for contains aPageableargument.booleanhasParameterAt(int position) Returns whether we have a parameter at the given position.booleanReturns whether the method theParameterswas created for contains aScoreargument.booleanbooleanReturns whether the method theParameterswas created for contains aScrollPositionargument.booleanReturns whether the method theParameterswas created for contains aSortargument.booleanbooleanReturns whether the method theParameterswas created for contains aVectorargument.static booleanisBindable(Class<?> type) Returns whether the given type is a bindable parameter.iterator()booleanReturns whether we potentially find aSortparameter in the parameters.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
TYPES
-
-
Constructor Details
-
Parameters
protected Parameters(ParametersSource parametersSource, Function<MethodParameter, T> parameterFactory) Creates a newParametersinstance for the givenMethodandFunctionto create aParameterinstance from aMethodParameter.- Parameters:
parametersSource- must not be null.parameterFactory- must not be null.- Since:
- 3.2.1
-
Parameters
Creates a newParametersinstance with the givenParameters put into new context.- Parameters:
originals-
-
-
Method Details
-
hasVectorParameter
public boolean hasVectorParameter()Returns whether the method theParameterswas created for contains aVectorargument.- Returns:
- Since:
- 4.0
-
getVectorIndex
public int getVectorIndex()Returns the index of theVectorargument.- Returns:
- the argument index or -1 if none defined.
- Since:
- 4.0
-
hasScoreParameter
public boolean hasScoreParameter()Returns whether the method theParameterswas created for contains aScoreargument.- Returns:
- Since:
- 4.0
-
getScoreIndex
public int getScoreIndex()Returns the index of theScoreargument.- Returns:
- the argument index or -1 if none defined.
- Since:
- 4.0
-
hasScoreRangeParameter
public boolean hasScoreRangeParameter()- Returns:
- Since:
- 4.0
-
getScoreRangeIndex
-
hasScrollPositionParameter
public boolean hasScrollPositionParameter()Returns whether the method theParameterswas created for contains aScrollPositionargument.- Returns:
- Since:
- 3.1
-
getScrollPositionIndex
public int getScrollPositionIndex()Returns the index of theScrollPositionMethodparameter if available. Will return -1 if there is noScrollPositionargument in theMethod's parameter list.- Returns:
- the scrollPositionIndex
- Since:
- 3.1
-
hasPageableParameter
public boolean hasPageableParameter()Returns whether the method theParameterswas created for contains aPageableargument.- Returns:
-
getPageableIndex
-
getSortIndex
-
hasSortParameter
public boolean hasSortParameter()Returns whether the method theParameterswas created for contains aSortargument.- Returns:
-
hasLimitParameter
public boolean hasLimitParameter()Returns whether the method theParameterswas created for contains aLimitargument.- Returns:
- Since:
- 3.2
-
getLimitIndex
-
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 aSortparameter 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
-
getNumberOfParameters
public int getNumberOfParameters()Returns the number of parameters.- Returns:
-
getBindableParameters
Returns aParametersinstance with effectively all special parameters removed.- Returns:
- See Also:
-
createFrom
-
getBindableParameter
-
isBindable
Returns whether the given type is a bindable parameter.- Parameters:
type-- Returns:
-
iterator
-