Interface QueryPostProcessor<T extends Repository,QUERY>
- Type Parameters:
T
-type
identifying theRepositories
to match on during registration.QUERY
-type
of the query to process.
- All Superinterfaces:
Ordered
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface QueryPostProcessor<T extends Repository,QUERY>
extends Ordered
The
QueryPostProcessor
interface defines a contract for implementations to post process
a given query
and possibly return a new or modified version of the same query
.
QueryPostProcessors
are useful for handling and processing queries
derived from Repository
QueryMethods
, and give a developer the opportunity,
via the callback, to further process the generated query
.
QueryPostProcessors
can be used on both derived queries
and manual queries
. Manual queries
are defined as
queries
specified using SDG's @Query
annotation or by defining a named
query
in a module-specific Properties
files
(e.g. META-INF/gemfire-named-queries.properties).- Since:
- 2.1.0
- Author:
- John Blum
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
getOrder()
default QUERY
postProcess
(QueryMethod queryMethod, QUERY query) Callback method invoked by the Spring Data (SD)Repository
framework to allow the user to process the givenquery
and (possibly) return a new or modified version of thequery
.postProcess
(QueryMethod queryMethod, QUERY query, Object... arguments) Callback method invoked by the Spring Data (SD)Repository
framework to allow the user to process the givenquery
and (possibly) return a new or modified version of thequery
.default QueryPostProcessor<T,
QUERY> processAfter
(QueryPostProcessor<T, QUERY> queryPostProcessor) Builder method used to compose thisQueryPostProcessors
with the givenQueryPostProcessor
.default QueryPostProcessor<T,
QUERY> processBefore
(QueryPostProcessor<T, QUERY> queryPostProcessor) Builder method used to compose thisQueryPostProcessor
with the givenQueryPostProcessor
.
-
Field Details
-
EMPTY_ARGUMENTS
-
-
Method Details
-
getOrder
default int getOrder()Defines theorder
of thisQueryPostProcessor
relative to otherQueryPostProcessors
in a sort. Defaults to theOrdered.LOWEST_PRECEDENCE
.- Specified by:
getOrder
in interfaceOrdered
- Returns:
- an
Integer
value specifying the order of thisQueryPostProcessor
relative to otherQueryPostProcessors
in a sort. - See Also:
-
postProcess
Callback method invoked by the Spring Data (SD)Repository
framework to allow the user to process the givenquery
and (possibly) return a new or modified version of thequery
. This callback is invoked for queries generated from a SDRepository
QueryMethod
signature as well as queries specified and defined inNamedQueries
, or even using SDG's@Query
annotation. -
postProcess
Callback method invoked by the Spring Data (SD)Repository
framework to allow the user to process the givenquery
and (possibly) return a new or modified version of thequery
. This callback is invoked for queries generated from a SDRepository
QueryMethod
signature as well as queries specified and defined inNamedQueries
, or even using SDG's@Query
annotation. -
processBefore
@NonNull default QueryPostProcessor<T,QUERY> processBefore(@Nullable QueryPostProcessor<T, QUERY> queryPostProcessor) Builder method used to compose thisQueryPostProcessor
with the givenQueryPostProcessor
. ThisQueryPostProcessor
will process the query before the givenQueryPostProcessor
in the processing chain.- Parameters:
queryPostProcessor
-QueryPostProcessor
to compose with thisQueryPostProcessor
.- Returns:
- a composed
QueryPostProcessor
consisting of thisQueryPostProcessor
followed by the givenQueryPostProcessor
. Returns thisQueryPostProcessor
if the givenQueryPostProcessor
is null. - See Also:
-
processAfter
@NonNull default QueryPostProcessor<T,QUERY> processAfter(@Nullable QueryPostProcessor<T, QUERY> queryPostProcessor) Builder method used to compose thisQueryPostProcessors
with the givenQueryPostProcessor
. ThisQueryPostProcessor
will process the query after the givenQueryPostProcessor
in the processing chain.- Parameters:
queryPostProcessor
-QueryPostProcessor
to compose with thisQueryPostProcessor
.- Returns:
- a composed
QueryPostProcessor
consisting of the givenQueryPostProcessor
followed by thisQueryPostProcessor
. Returns thisQueryPostProcessor
if the givenQueryPostProcessor
is null. - See Also:
-