1- package org .baeldung .persistence .dao ;
1+ package com .baeldung .persistence .dao ;
22
33import java .util .ArrayList ;
44import java .util .Collections ;
88import java .util .function .Function ;
99import java .util .stream .Collectors ;
1010
11- import org .baeldung .web .util .SearchOperation ;
12- import org .baeldung .web .util .SpecSearchCriteria ;
1311import org .springframework .data .jpa .domain .Specification ;
14- import org .springframework .data .jpa .domain .Specifications ;
12+
13+ import com .baeldung .web .util .SearchOperation ;
14+ import com .baeldung .web .util .SpecSearchCriteria ;
1515
1616public class GenericSpecificationsBuilder <U > {
1717
@@ -61,11 +61,12 @@ public Specification<U> build(Function<SpecSearchCriteria, Specification<U>> con
6161 for (int idx = 1 ; idx < specs .size (); idx ++) {
6262 result = params .get (idx )
6363 .isOrPredicate ()
64- ? Specifications .where (result )
64+ ? Specification .where (result )
6565 .or (specs .get (idx ))
66- : Specifications .where (result )
66+ : Specification .where (result )
6767 .and (specs .get (idx ));
6868 }
69+
6970 return result ;
7071 }
7172
@@ -84,10 +85,10 @@ public Specification<U> build(Deque<?> postFixedExprStack, Function<SpecSearchCr
8485 Specification <U > operand1 = specStack .pop ();
8586 Specification <U > operand2 = specStack .pop ();
8687 if (mayBeOperand .equals (SearchOperation .AND_OPERATOR ))
87- specStack .push (Specifications .where (operand1 )
88+ specStack .push (Specification .where (operand1 )
8889 .and (operand2 ));
8990 else if (mayBeOperand .equals (SearchOperation .OR_OPERATOR ))
90- specStack .push (Specifications .where (operand1 )
91+ specStack .push (Specification .where (operand1 )
9192 .or (operand2 ));
9293 }
9394
0 commit comments