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.
18
18
import org .springframework .data .domain .Page ;
19
19
import org .springframework .data .domain .Pageable ;
20
20
21
+ import com .mysema .query .NonUniqueResultException ;
21
22
import com .mysema .query .types .OrderSpecifier ;
22
23
import com .mysema .query .types .Predicate ;
23
24
24
25
/**
25
26
* Interface to allow execution of QueryDsl {@link Predicate} instances.
26
27
*
27
28
* @author Oliver Gierke
29
+ * @author Thomas Darimont
28
30
*/
29
31
public interface QueryDslPredicateExecutor <T > {
30
32
31
33
/**
32
- * Returns a single entity matching the given {@link Predicate}.
34
+ * Returns a single entity matching the given {@link Predicate} or {@literal null} if none was found.
35
+ * If the predicate yields more than one result a {@link NonUniqueResultException} is thrown.
33
36
*
34
- * @param spec
37
+ * @param predicate
35
38
* @return
36
39
*/
37
40
T findOne (Predicate predicate );
38
41
39
42
/**
40
43
* Returns all entities matching the given {@link Predicate}.
44
+ * In case no match could be found an empty {@link Iterable} is returned.
41
45
*
42
- * @param spec
46
+ * @param predicate
43
47
* @return
44
48
*/
45
49
Iterable <T > findAll (Predicate predicate );
46
50
47
51
/**
48
52
* Returns all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s.
53
+ * In case no match could be found an empty {@link Iterable} is returned.
49
54
*
50
55
* @param predicate
51
56
* @param orders
@@ -55,6 +60,7 @@ public interface QueryDslPredicateExecutor<T> {
55
60
56
61
/**
57
62
* Returns a {@link Page} of entities matching the given {@link Predicate}.
63
+ * In case no match could be found, an empty {@link Page} is returned.
58
64
*
59
65
* @param predicate
60
66
* @param pageable
0 commit comments