File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/main/java/org/springframework/data/repository/query Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2016 the original author or authors.
2
+ * Copyright 2016-2017 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 .repository .query ;
17
17
18
+ import java .util .Optional ;
19
+
18
20
import org .springframework .data .domain .Example ;
19
21
import org .springframework .data .domain .Page ;
20
22
import org .springframework .data .domain .Pageable ;
25
27
*
26
28
* @param <T>
27
29
* @author Mark Paluch
30
+ * @author Christoph Strobl
28
31
* @since 1.12
29
32
*/
30
33
public interface QueryByExampleExecutor <T > {
@@ -33,10 +36,10 @@ public interface QueryByExampleExecutor<T> {
33
36
* Returns a single entity matching the given {@link Example} or {@literal null} if none was found.
34
37
*
35
38
* @param example can be {@literal null}.
36
- * @return a single entity matching the given {@link Example} or {@literal null } if none was found.
39
+ * @return a single entity matching the given {@link Example} or {@link Optional#empty() } if none was found.
37
40
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the Example yields more than one result.
38
41
*/
39
- <S extends T > S findOne (Example <S > example );
42
+ <S extends T > Optional < S > findOne (Example <S > example );
40
43
41
44
/**
42
45
* Returns all entities matching the given {@link Example}. In case no match could be found an empty {@link Iterable}
You can’t perform that action at this time.
0 commit comments