20
20
import java .util .Collections ;
21
21
import java .util .function .Function ;
22
22
import java .util .function .Predicate ;
23
+ import java .util .stream .Collectors ;
23
24
24
25
import org .mybatis .dynamic .sql .AbstractListValueCondition ;
25
26
import org .mybatis .dynamic .sql .render .RenderingContext ;
@@ -38,7 +39,7 @@ public static <T> IsInCaseInsensitive<T> empty() {
38
39
}
39
40
40
41
protected IsInCaseInsensitive (Collection <T > values ) {
41
- super (values );
42
+ super (values . stream (). map ( StringUtilities :: upperCaseIfPossible ). collect ( Collectors . toList ()) );
42
43
}
43
44
44
45
@ Override
@@ -57,19 +58,6 @@ public IsInCaseInsensitive<T> filter(Predicate<? super T> predicate) {
57
58
return filterSupport (predicate , IsInCaseInsensitive ::new , this , IsInCaseInsensitive ::empty );
58
59
}
59
60
60
- /**
61
- * If renderable, apply the mapping to the value and return a new condition with the new value. Else return a
62
- * condition that will not render (this).
63
- *
64
- * <p>This function DOES NOT automatically transform values to uppercase, so it potentially creates a
65
- * case-sensitive query. For String conditions you can use {@link StringUtilities#mapToUpperCase(Function)}
66
- * to add an uppercase transform after your mapping function.
67
- *
68
- * @param mapper a mapping function to apply to the value, if renderable
69
- * @param <R> type of the new condition
70
- * @return a new condition with the result of applying the mapper to the value of this condition,
71
- * if renderable, otherwise a condition that will not render.
72
- */
73
61
@ Override
74
62
public <R > IsInCaseInsensitive <R > map (Function <? super T , ? extends R > mapper ) {
75
63
return mapSupport (mapper , IsInCaseInsensitive ::new , IsInCaseInsensitive ::empty );
@@ -80,7 +68,6 @@ public static IsInCaseInsensitive<String> of(String... values) {
80
68
}
81
69
82
70
public static IsInCaseInsensitive <String > of (Collection <String > values ) {
83
- // Keep the null safe upper case utility for backwards compatibility in case someone passes in a null
84
- return new IsInCaseInsensitive <>(values .stream ().map (StringUtilities ::safelyUpperCase ).toList ());
71
+ return new IsInCaseInsensitive <>(values );
85
72
}
86
73
}
0 commit comments