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
ConstructorsModifierConstructorDescriptionParameters(Method method) Creates a new instance ofParameters.protectedParameters(List<T> originals) Creates a newParametersinstance with the givenParameters put into new context. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ScreateFrom(List<T> parameters) protected abstract TcreateParameter(MethodParameter parameter) Creates aParameterinstance for the givenMethodParameter.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.intReturns the number of parameters.intgetParameter(int index) Returns the parameter with the given index.intbooleanReturns whether a parameter expressing a dynamic projection exists.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 aSortargument.booleanstatic 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
TYPES
-
-
Constructor Details
-
Parameters
Creates a new instance ofParameters.- Parameters:
method- must not be null.
-
Parameters
Creates a newParametersinstance with the givenParameters put into new context.- Parameters:
originals-
-
-
Method Details
-
createParameter
Creates aParameterinstance for the givenMethodParameter.- Parameters:
parameter- will never be null.- Returns:
-
hasPageableParameter
public boolean hasPageableParameter()Returns whether the method theParameterswas created for contains aPageableargument.- Returns:
-
getPageableIndex
public int getPageableIndex()Returns the index of thePageableMethodparameter if available. Will return -1 if there is noPageableargument in theMethod's parameter list.- Returns:
- the pageableIndex
-
getSortIndex
public int getSortIndex()Returns the index of theSortMethodparameter if available. Will return -1 if there is noSortargument in theMethod's parameter list.- Returns:
-
hasSortParameter
public boolean hasSortParameter()Returns whether the method theParameterswas created for contains aSortargument.- 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 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
public boolean hasSpecialParameter()- Returns:
-
getNumberOfParameters
public int getNumberOfParameters()Returns the number of parameters.- Returns:
-
getBindableParameters
Returns aParametersinstance with effectively all special parameters removed.- Returns:
- See Also:
-
Parameter.TYPESParameter.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 theStringparameter.- Parameters:
bindableIndex-- Returns:
-
isBindable
Returns whether the given type is a bindable parameter.- Parameters:
type-- Returns:
-
iterator
-