1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.dynamic.sql.where.condition;
17
18 import java.util.Arrays;
19 import java.util.Collection;
20 import java.util.Collections;
21 import java.util.Objects;
22 import java.util.function.Predicate;
23 import java.util.function.UnaryOperator;
24 import java.util.stream.Collectors;
25
26 import org.mybatis.dynamic.sql.AbstractListValueCondition;
27 import org.mybatis.dynamic.sql.util.StringUtilities;
28
29 public class IsNotInCaseInsensitiveWhenPresent extends AbstractListValueCondition<String>
30 implements CaseInsensitiveVisitableCondition {
31 private static final IsNotInCaseInsensitiveWhenPresent EMPTY = new IsNotInCaseInsensitiveWhenPresent(Collections.emptyList());
32
33 public static IsNotInCaseInsensitiveWhenPresent empty() {
34 return EMPTY;
35 }
36
37 protected IsNotInCaseInsensitiveWhenPresent(Collection<String> values) {
38 super(values.stream().filter(Objects::nonNull).collect(Collectors.toList()));
39 }
40
41 @Override
42 public String operator() {
43 return "not in";
44 }
45
46 @Override
47 public IsNotInCaseInsensitiveWhenPresent filter(Predicate<? super String> predicate) {
48 return filterSupport(predicate, IsNotInCaseInsensitiveWhenPresent::new, this, IsNotInCaseInsensitiveWhenPresent::empty);
49 }
50
51
52
53
54
55
56
57
58 public IsNotInCaseInsensitiveWhenPresent map(UnaryOperator<String> mapper) {
59 return mapSupport(mapper, IsNotInCaseInsensitiveWhenPresent::new, IsNotInCaseInsensitiveWhenPresent::empty);
60 }
61
62 public static IsNotInCaseInsensitiveWhenPresent of(String... values) {
63 return of(Arrays.asList(values));
64 }
65
66 public static IsNotInCaseInsensitiveWhenPresent of(Collection<String> values) {
67 return new IsNotInCaseInsensitiveWhenPresent(values).map(StringUtilities::safelyUpperCase);
68 }
69 }