public class QuerydslRepositoryInvokerAdapter extends Object implements 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.Constructor and Description |
---|
QuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate,
QuerydslPredicateExecutor<Object> executor,
com.querydsl.core.types.Predicate predicate)
Creates a new
QuerydslRepositoryInvokerAdapter for the given delegate RepositoryInvoker ,
QuerydslPredicateExecutor and Querydsl Predicate . |
Modifier and Type | Method and Description |
---|---|
boolean |
hasDeleteMethod()
Returns whether the repository has a method to delete objects.
|
boolean |
hasFindAllMethod()
Returns whether the repository has a method to find all objects.
|
boolean |
hasFindOneMethod()
Returns whether the repository has a method to find a single object.
|
boolean |
hasSaveMethod()
Returns whether the repository has a method to save objects.
|
void |
invokeDeleteById(Object id)
Invokes the method equivalent to
CrudRepository.deleteById(Object) . |
Iterable<Object> |
invokeFindAll(Pageable pageable)
Invokes the find-all method of the underlying repository using the method taking a
Pageable as parameter if
available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Pageable) ), using the method taking
a Sort if available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Sort) by extracting the Sort
contained in the given Pageable ) or the plain equivalent to
CrudRepository.findAll() . |
Iterable<Object> |
invokeFindAll(Sort sort)
Invokes the find-all method of the underlying repository using the method taking a
Sort as parameter if
available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Sort) ) or the plain equivalent to
CrudRepository.findAll() . |
<T> Optional<T> |
invokeFindById(Object id)
Invokes the method equivalent to
CrudRepository.findById(Object) . |
Optional<Object> |
invokeQueryMethod(Method method,
MultiValueMap<String,? extends Object> parameters,
Pageable pageable,
Sort sort)
|
<T> T |
invokeSave(T object)
Invokes the method equivalent to
CrudRepository.save(Object) on the
repository. |
public QuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate, QuerydslPredicateExecutor<Object> executor, com.querydsl.core.types.Predicate predicate)
QuerydslRepositoryInvokerAdapter
for the given delegate RepositoryInvoker
,
QuerydslPredicateExecutor
and Querydsl Predicate
.delegate
- must not be null.executor
- must not be null.predicate
- can be null.public Iterable<Object> invokeFindAll(Pageable pageable)
RepositoryInvoker
Pageable
as parameter if
available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Pageable)
), using the method taking
a Sort
if available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Sort)
by extracting the Sort
contained in the given Pageable
) or the plain equivalent to
CrudRepository.findAll()
.invokeFindAll
in interface RepositoryInvoker
pageable
- can be null.public Iterable<Object> invokeFindAll(Sort sort)
RepositoryInvoker
Sort
as parameter if
available (i.e. the equivalent to
PagingAndSortingRepository.findAll(Sort)
) or the plain equivalent to
CrudRepository.findAll()
.invokeFindAll
in interface RepositoryInvoker
public boolean hasDeleteMethod()
RepositoryInvocationInformation
hasDeleteMethod
in interface RepositoryInvocationInformation
public boolean hasFindAllMethod()
RepositoryInvocationInformation
hasFindAllMethod
in interface RepositoryInvocationInformation
public boolean hasFindOneMethod()
RepositoryInvocationInformation
hasFindOneMethod
in interface RepositoryInvocationInformation
public boolean hasSaveMethod()
RepositoryInvocationInformation
hasSaveMethod
in interface RepositoryInvocationInformation
public void invokeDeleteById(Object id)
RepositoryInvoker
CrudRepository.deleteById(Object)
. The
given id is assumed to be of a type convertible into the actual identifier type of the backing repository.invokeDeleteById
in interface RepositoryInvoker
id
- must not be null.public <T> Optional<T> invokeFindById(Object id)
RepositoryInvoker
CrudRepository.findById(Object)
.invokeFindById
in interface RepositoryInvoker
id
- must not be null.public Optional<Object> invokeQueryMethod(Method method, MultiValueMap<String,? extends Object> parameters, Pageable pageable, Sort sort)
RepositoryInvoker
invokeQueryMethod
in interface RepositoryInvoker
method
- must not be null.parameters
- must not be null.pageable
- must not be null.sort
- must not be null.public <T> T invokeSave(T object)
RepositoryInvoker
CrudRepository.save(Object)
on the
repository.invokeSave
in interface RepositoryInvoker
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.