|
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 org.springframework.dao.IncorrectResultSizeDataAccessException; |
18 | 19 | import org.springframework.data.domain.Page;
|
19 | 20 | import org.springframework.data.domain.Pageable;
|
20 | 21 |
|
|
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. |
33 | 35 | *
|
34 |
| - * @param spec |
35 |
| - * @return |
| 36 | + * @param predicate |
| 37 | + * @return a single entity matching the given {@link Predicate} or {@literal null} if none was found. |
| 38 | + * @throws IncorrectResultSizeDataAccessException if the predicate yields more than one result. |
36 | 39 | */
|
37 | 40 | T findOne(Predicate predicate);
|
38 | 41 |
|
39 | 42 | /**
|
40 |
| - * Returns all entities matching the given {@link Predicate}. |
| 43 | + * Returns all entities matching the given {@link Predicate}. In case no match could be found an empty |
| 44 | + * {@link Iterable} is returned. |
41 | 45 | *
|
42 |
| - * @param spec |
43 |
| - * @return |
| 46 | + * @param predicate |
| 47 | + * @return all entities matching the given {@link Predicate}. |
44 | 48 | */
|
45 | 49 | Iterable<T> findAll(Predicate predicate);
|
46 | 50 |
|
47 | 51 | /**
|
48 |
| - * Returns all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s. |
| 52 | + * Returns all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s. In case no |
| 53 | + * match could be found an empty {@link Iterable} is returned. |
49 | 54 | *
|
50 | 55 | * @param predicate
|
51 | 56 | * @param orders
|
52 |
| - * @return |
| 57 | + * @return all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s. |
53 | 58 | */
|
54 | 59 | Iterable<T> findAll(Predicate predicate, OrderSpecifier<?>... orders);
|
55 | 60 |
|
56 | 61 | /**
|
57 |
| - * Returns a {@link Page} of entities matching the given {@link Predicate}. |
| 62 | + * Returns a {@link Page} of entities matching the given {@link Predicate}. In case no match could be found, an empty |
| 63 | + * {@link Page} is returned. |
58 | 64 | *
|
59 | 65 | * @param predicate
|
60 | 66 | * @param pageable
|
61 |
| - * @return |
| 67 | + * @return a {@link Page} of entities matching the given {@link Predicate}. |
62 | 68 | */
|
63 | 69 | Page<T> findAll(Predicate predicate, Pageable pageable);
|
64 | 70 |
|
|
0 commit comments