16
16
package org .springframework .data .querydsl ;
17
17
18
18
import java .util .List ;
19
- import java .util .Optional ;
20
- import java .util .function .Function ;
21
19
22
- import org .springframework .data .domain .Page ;
23
- import org .springframework .data .domain .Pageable ;
24
20
import org .springframework .data .domain .Sort ;
25
- import org .springframework .data .repository .query .FluentQuery ;
26
21
27
22
import com .querydsl .core .types .OrderSpecifier ;
28
23
import com .querydsl .core .types .Predicate ;
29
24
30
25
/**
31
- * Interface to allow execution of QueryDsl {@link Predicate} instances.This identical to *
32
- * {@link QuerydslPredicateExecutor} but returns {@link List} instead of {@link Iterable} where applicable.
26
+ * Interface to allow execution of QueryDsl {@link Predicate} instances. This an extension to
27
+ * {@link QuerydslPredicateExecutor} returning {@link List} instead of {@link Iterable} where applicable.
33
28
*
34
29
* @author Jens Schauder
35
30
* @since 3.0
36
31
* @see QuerydslPredicateExecutor
37
32
*/
38
- public interface ListQuerydslPredicateExecutor <T > {
39
-
40
- /**
41
- * Returns a single entity matching the given {@link Predicate} or {@link Optional#empty()} if none was found.
42
- *
43
- * @param predicate must not be {@literal null}.
44
- * @return a single entity matching the given {@link Predicate} or {@link Optional#empty()} if none was found.
45
- * @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the predicate yields more than one
46
- * result.
47
- */
48
- Optional <T > findOne (Predicate predicate );
33
+ public interface ListQuerydslPredicateExecutor <T > extends QuerydslPredicateExecutor <T > {
49
34
50
35
/**
51
36
* Returns all entities matching the given {@link Predicate}. In case no match could be found an empty {@link List} is
@@ -54,6 +39,7 @@ public interface ListQuerydslPredicateExecutor<T> {
54
39
* @param predicate must not be {@literal null}.
55
40
* @return all entities matching the given {@link Predicate}.
56
41
*/
42
+ @ Override
57
43
List <T > findAll (Predicate predicate );
58
44
59
45
/**
@@ -65,6 +51,7 @@ public interface ListQuerydslPredicateExecutor<T> {
65
51
* {@literal null}.
66
52
* @return all entities matching the given {@link Predicate}.
67
53
*/
54
+ @ Override
68
55
List <T > findAll (Predicate predicate , Sort sort );
69
56
70
57
/**
@@ -75,6 +62,7 @@ public interface ListQuerydslPredicateExecutor<T> {
75
62
* @param orders the {@link OrderSpecifier}s to sort the results by, must not be {@literal null}.
76
63
* @return all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s.
77
64
*/
65
+ @ Override
78
66
List <T > findAll (Predicate predicate , OrderSpecifier <?>... orders );
79
67
80
68
/**
@@ -83,41 +71,7 @@ public interface ListQuerydslPredicateExecutor<T> {
83
71
* @param orders the {@link OrderSpecifier}s to sort the results by, must not be {@literal null}.
84
72
* @return all entities ordered by the given {@link OrderSpecifier}s.
85
73
*/
74
+ @ Override
86
75
List <T > findAll (OrderSpecifier <?>... orders );
87
76
88
- /**
89
- * Returns a {@link Page} of entities matching the given {@link Predicate}. In case no match could be found, an empty
90
- * {@link Page} is returned.
91
- *
92
- * @param predicate must not be {@literal null}.
93
- * @param pageable may be {@link Pageable#unpaged()}, must not be {@literal null}.
94
- * @return a {@link Page} of entities matching the given {@link Predicate}.
95
- */
96
- Page <T > findAll (Predicate predicate , Pageable pageable );
97
-
98
- /**
99
- * Returns the number of instances matching the given {@link Predicate}.
100
- *
101
- * @param predicate the {@link Predicate} to count instances for, must not be {@literal null}.
102
- * @return the number of instances matching the {@link Predicate}.
103
- */
104
- long count (Predicate predicate );
105
-
106
- /**
107
- * Checks whether the data store contains elements that match the given {@link Predicate}.
108
- *
109
- * @param predicate the {@link Predicate} to use for the existence check, must not be {@literal null}.
110
- * @return {@literal true} if the data store contains elements that match the given {@link Predicate}.
111
- */
112
- boolean exists (Predicate predicate );
113
-
114
- /**
115
- * Returns entities matching the given {@link Predicate} applying the {@link Function queryFunction} that defines the
116
- * query and its result type.
117
- *
118
- * @param predicate must not be {@literal null}.
119
- * @param queryFunction the query function defining projection, sorting, and the result type
120
- * @return all entities matching the given {@link Predicate}.
121
- */
122
- <S extends T , R > R findBy (Predicate predicate , Function <FluentQuery .FetchableFluentQuery <S >, R > queryFunction );
123
77
}
0 commit comments