1
1
/*
2
- * Copyright 2011 the original author or authors.
2
+ * Copyright 2011-2014 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
15
15
*/
16
16
package org .springframework .data .querydsl ;
17
17
18
+ import java .util .List ;
19
+
18
20
import org .springframework .data .domain .Page ;
19
21
import org .springframework .data .domain .Pageable ;
20
22
23
+ import com .mysema .query .NonUniqueResultException ;
21
24
import com .mysema .query .types .OrderSpecifier ;
22
25
import com .mysema .query .types .Predicate ;
23
26
24
27
/**
25
28
* Interface to allow execution of QueryDsl {@link Predicate} instances.
26
29
*
27
30
* @author Oliver Gierke
31
+ * @author Thomas Darimont
28
32
*/
29
33
public interface QueryDslPredicateExecutor <T > {
30
34
31
35
/**
32
- * Returns a single entity matching the given {@link Predicate}.
36
+ * Returns a single entity matching the given {@link Predicate} or {@literal null} if none was found.
37
+ * If the predicate yields more than one result a {@link NonUniqueResultException} is thrown.
33
38
*
34
- * @param spec
39
+ * @param predicate
35
40
* @return
36
41
*/
37
42
T findOne (Predicate predicate );
38
43
39
44
/**
40
45
* Returns all entities matching the given {@link Predicate}.
46
+ * In case no match could be found an empty {@link List} is returned.
41
47
*
42
- * @param spec
48
+ * @param predicate
43
49
* @return
44
50
*/
45
51
Iterable <T > findAll (Predicate predicate );
46
52
47
53
/**
48
54
* Returns all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s.
55
+ * In case no match could be found an empty {@link List} is returned.
49
56
*
50
57
* @param predicate
51
58
* @param orders
@@ -55,6 +62,7 @@ public interface QueryDslPredicateExecutor<T> {
55
62
56
63
/**
57
64
* Returns a {@link Page} of entities matching the given {@link Predicate}.
65
+ * In case no match could be found, a {@link Page} containing an empty {@link List} is returned.
58
66
*
59
67
* @param predicate
60
68
* @param pageable
0 commit comments