Class QuerydslRepositoryInvokerAdapter
java.lang.Object
org.springframework.data.querydsl.QuerydslRepositoryInvokerAdapter
- All Implemented Interfaces:
RepositoryInvocationInformation,RepositoryInvoker
RepositoryInvoker that is aware of a QuerydslPredicateExecutor and Predicate to be executed
for all flavors of findAll(…). All other calls are forwarded to the configured delegate.- Author:
- Oliver Gierke
-
Constructor Summary
ConstructorsConstructorDescriptionQuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate, QuerydslPredicateExecutor<Object> executor, com.querydsl.core.types.Predicate predicate) Creates a newQuerydslRepositoryInvokerAdapterfor the given delegateRepositoryInvoker,QuerydslPredicateExecutorand QuerydslPredicate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the repository has a method to delete objects.booleanReturns whether the repository has a method to find all objects.booleanReturns whether the repository has a method to find a single object.booleanReturns whether the repository has a method to save objects.voidInvokes the method equivalent toCrudRepository.deleteById(Object).invokeFindAll(Pageable pageable) Invokes the find-all method of the underlying repository using the method taking aPageableas parameter if available (i.e. the equivalent toPagingAndSortingRepository.findAll(Pageable)), using the method taking aSortif available (i.e. the equivalent toPagingAndSortingRepository.findAll(Sort)by extracting theSortcontained in the givenPageable) or the plain equivalent toCrudRepository.findAll().invokeFindAll(Sort sort) Invokes the find-all method of the underlying repository using the method taking aSortas parameter if available (i.e. the equivalent toPagingAndSortingRepository.findAll(Sort)) or the plain equivalent toCrudRepository.findAll().<T> Optional<T>invokeFindById(Object id) Invokes the method equivalent toCrudRepository.findById(Object).invokeQueryMethod(Method method, MultiValueMap<String, ? extends Object> parameters, Pageable pageable, Sort sort) <T> TinvokeSave(T object) Invokes the method equivalent toCrudRepository.save(Object)on the repository.
-
Constructor Details
-
QuerydslRepositoryInvokerAdapter
public QuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate, QuerydslPredicateExecutor<Object> executor, com.querydsl.core.types.Predicate predicate) Creates a newQuerydslRepositoryInvokerAdapterfor the given delegateRepositoryInvoker,QuerydslPredicateExecutorand QuerydslPredicate.- Parameters:
delegate- must not be null.executor- must not be null.predicate- can be null.
-
-
Method Details
-
invokeFindAll
Description copied from interface:RepositoryInvokerInvokes the find-all method of the underlying repository using the method taking aPageableas parameter if available (i.e. the equivalent toPagingAndSortingRepository.findAll(Pageable)), using the method taking aSortif available (i.e. the equivalent toPagingAndSortingRepository.findAll(Sort)by extracting theSortcontained in the givenPageable) or the plain equivalent toCrudRepository.findAll().- Specified by:
invokeFindAllin interfaceRepositoryInvoker- Parameters:
pageable- must not be null.- Returns:
- the result of the invocation of the find-all method.
-
invokeFindAll
Description copied from interface:RepositoryInvokerInvokes the find-all method of the underlying repository using the method taking aSortas parameter if available (i.e. the equivalent toPagingAndSortingRepository.findAll(Sort)) or the plain equivalent toCrudRepository.findAll().- Specified by:
invokeFindAllin interfaceRepositoryInvoker- Parameters:
sort- must not be null.- Returns:
- the result of the invocation of the find-all method.
-
hasDeleteMethod
public boolean hasDeleteMethod()Description copied from interface:RepositoryInvocationInformationReturns whether the repository has a method to delete objects.- Specified by:
hasDeleteMethodin interfaceRepositoryInvocationInformation- Returns:
-
hasFindAllMethod
public boolean hasFindAllMethod()Description copied from interface:RepositoryInvocationInformationReturns whether the repository has a method to find all objects.- Specified by:
hasFindAllMethodin interfaceRepositoryInvocationInformation- Returns:
-
hasFindOneMethod
public boolean hasFindOneMethod()Description copied from interface:RepositoryInvocationInformationReturns whether the repository has a method to find a single object.- Specified by:
hasFindOneMethodin interfaceRepositoryInvocationInformation- Returns:
-
hasSaveMethod
public boolean hasSaveMethod()Description copied from interface:RepositoryInvocationInformationReturns whether the repository has a method to save objects.- Specified by:
hasSaveMethodin interfaceRepositoryInvocationInformation- Returns:
-
invokeDeleteById
Description copied from interface:RepositoryInvokerInvokes the method equivalent toCrudRepository.deleteById(Object). The given id is assumed to be of a type convertible into the actual identifier type of the backing repository.- Specified by:
invokeDeleteByIdin interfaceRepositoryInvoker- Parameters:
id- must not be null.
-
invokeFindById
Description copied from interface:RepositoryInvokerInvokes the method equivalent toCrudRepository.findById(Object).- Specified by:
invokeFindByIdin interfaceRepositoryInvoker- Parameters:
id- must not be null.- Returns:
- the entity with the given id.
-
invokeQueryMethod
public Optional<Object> invokeQueryMethod(Method method, MultiValueMap<String, ? extends Object> parameters, Pageable pageable, Sort sort) Description copied from interface:RepositoryInvoker- Specified by:
invokeQueryMethodin interfaceRepositoryInvoker- Parameters:
method- must not be null.parameters- must not be null.pageable- must not be null.sort- must not be null.- Returns:
- the result of the invoked query method.
-
invokeSave
public <T> T invokeSave(T object) Description copied from interface:RepositoryInvokerInvokes the method equivalent toCrudRepository.save(Object)on the repository.- Specified by:
invokeSavein interfaceRepositoryInvoker- Returns:
- the result of the invocation of the save method
-