Class ParameterBinder
java.lang.Object
com.blazebit.persistence.spring.data.base.query.ParameterBinder
- Direct Known Subclasses:
AbstractCriteriaQueryParameterBinder
ParameterBinder is used to bind method parameters to a Query. This is usually done whenever an
AbstractJpaQuery is executed.
Christian Beikov: Copied to be able to share code between Spring Data integrations for 1.x and 2.x.- Since:
- 1.6.9
- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Eugen Mayer
-
Constructor Summary
ConstructorsConstructorDescriptionParameterBinder(JpaParameters parameters, Object[] values) Creates a newParameterBinder. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbind(jakarta.persistence.Query query, JpaParameters.JpaParameter parameter, Object value, int position) Perform the actual query parameter binding.<T extends jakarta.persistence.Query>
Tbind(T query) Binds the parameters to the givenQuery.jakarta.persistence.QuerybindAndPrepare(jakarta.persistence.Query query) Binds the parameters to the given query and applies special parameter types (e.g. pagination).protected booleancanBindParameter(org.springframework.data.repository.query.Parameter parameter) Returns true if the given parameter can be bound.protected abstract intorg.springframework.data.domain.PageableReturns thePageableof the parameters, if available.org.springframework.data.domain.SortgetSort()Returns the sort instance to be used for query creation.protected Object[]
-
Constructor Details
-
ParameterBinder
Creates a newParameterBinder.- Parameters:
parameters- must not be null.values- must not be null.
-
-
Method Details
-
getPageable
public org.springframework.data.domain.Pageable getPageable()Returns thePageableof the parameters, if available. Returnsnullotherwise.- Returns:
-
getSort
public org.springframework.data.domain.Sort getSort()Returns the sort instance to be used for query creation. Will use aSortparameter if available or theSortcontained in aPageableif available. Returnsnullif noSortcan be found.- Returns:
-
bind
public <T extends jakarta.persistence.Query> T bind(T query) Binds the parameters to the givenQuery.- Parameters:
query-- Returns:
-
canBindParameter
protected boolean canBindParameter(org.springframework.data.repository.query.Parameter parameter) Returns true if the given parameter can be bound.- Parameters:
parameter-- Returns:
-
bind
protected void bind(jakarta.persistence.Query query, JpaParameters.JpaParameter parameter, Object value, int position) Perform the actual query parameter binding.- Parameters:
query-parameter-value-position-
-
bindAndPrepare
public jakarta.persistence.Query bindAndPrepare(jakarta.persistence.Query query) Binds the parameters to the given query and applies special parameter types (e.g. pagination).- Parameters:
query-- Returns:
-
getOffset
protected abstract int getOffset() -
getValues
-