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 |
invokeDelete(Serializable id)
Invokes the method equivalent to
CrudRepository.delete(Serializable) . |
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> T |
invokeFindOne(Serializable id)
Invokes the method equivalent to
CrudRepository.findOne(Serializable) . |
Object |
invokeQueryMethod(Method method,
Map<String,String[]> parameters,
Pageable pageable,
Sort sort)
|
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 invokeDelete(Serializable id)
RepositoryInvoker
CrudRepository.delete(Serializable)
.
The given id is assumed to be of a type convertable into the actual identifier type of the backing repository.invokeDelete
in interface RepositoryInvoker
id
- must not be null. throws IllegalStateException
if the repository does not expose a
delete-method.public <T> T invokeFindOne(Serializable id)
RepositoryInvoker
CrudRepository.findOne(Serializable)
.invokeFindOne
in interface RepositoryInvoker
id
- must not be null.public Object invokeQueryMethod(Method method, Map<String,String[]> parameters, Pageable pageable, Sort sort)
RepositoryInvoker
invokeQueryMethod
in interface RepositoryInvoker
method
- must not be null.parameters
- must not be null.pageable
- can be null.sort
- can be null.public 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
- can be null.sort
- can be null.public <T> T invokeSave(T object)
RepositoryInvoker
CrudRepository.save(Object)
on the
repository.invokeSave
in interface RepositoryInvoker
Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.