Skip to content

Commit afd76f8

Browse files
schaudermp911de
authored andcommitted
DATAJPA-1622 - Polishing.
Added documentation and replaced lambdas with method references. Original pull request: #397.
1 parent 56fc5bf commit afd76f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/springframework/data/jpa/domain/Specification.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public interface Specification<T> extends Serializable {
4343
/**
4444
* Negates the given {@link Specification}.
4545
*
46-
* @param <T>
46+
* @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
4747
* @param spec can be {@literal null}.
48-
* @return
48+
* @return guaranteed to be not {@literal null}.
4949
* @since 2.0
5050
*/
5151
static <T> Specification<T> not(@Nullable Specification<T> spec) {
@@ -58,9 +58,9 @@ static <T> Specification<T> not(@Nullable Specification<T> spec) {
5858
/**
5959
* Simple static factory method to add some syntactic sugar around a {@link Specification}.
6060
*
61-
* @param <T>
61+
* @param <T> the type of the {@link Root} the resulting {@literal Specification} operates on.
6262
* @param spec can be {@literal null}.
63-
* @return
63+
* @return guaranteed to be not {@literal null}.
6464
* @since 2.0
6565
*/
6666
static <T> Specification<T> where(@Nullable Specification<T> spec) {
@@ -76,7 +76,7 @@ static <T> Specification<T> where(@Nullable Specification<T> spec) {
7676
*/
7777

7878
default Specification<T> and(@Nullable Specification<T> other) {
79-
return composed(this, other, (builder, left, rhs) -> builder.and(left, rhs));
79+
return composed(this, other, CriteriaBuilder::and);
8080
}
8181

8282
/**
@@ -87,7 +87,7 @@ default Specification<T> and(@Nullable Specification<T> other) {
8787
* @since 2.0
8888
*/
8989
default Specification<T> or(@Nullable Specification<T> other) {
90-
return composed(this, other, (builder, left, rhs) -> builder.or(left, rhs));
90+
return composed(this, other, CriteriaBuilder::or);
9191
}
9292

9393
/**

0 commit comments

Comments
 (0)