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.NoSuchElementException;
19 import java.util.function.Function;
20 import java.util.function.Predicate;
21
22 import org.mybatis.dynamic.sql.AbstractSingleValueCondition;
23
24 public class IsNotLike<T> extends AbstractSingleValueCondition<T>
25 implements AbstractSingleValueCondition.Filterable<T>, AbstractSingleValueCondition.Mappable<T> {
26 private static final IsNotLike<?> EMPTY = new IsNotLike<Object>(-1) {
27 @Override
28 public Object value() {
29 throw new NoSuchElementException("No value present");
30 }
31
32 @Override
33 public boolean isEmpty() {
34 return true;
35 }
36 };
37
38 public static <T> IsNotLike<T> empty() {
39 @SuppressWarnings("unchecked")
40 IsNotLike<T> t = (IsNotLike<T>) EMPTY;
41 return t;
42 }
43
44 protected IsNotLike(T value) {
45 super(value);
46 }
47
48 @Override
49 public String operator() {
50 return "not like";
51 }
52
53 public static <T> IsNotLike<T> of(T value) {
54 return new IsNotLike<>(value);
55 }
56
57 @Override
58 public IsNotLike<T> filter(Predicate<? super T> predicate) {
59 return filterSupport(predicate, IsNotLike::empty, this);
60 }
61
62 @Override
63 public <R> IsNotLike<R> map(Function<? super T, ? extends R> mapper) {
64 return mapSupport(mapper, IsNotLike::new, IsNotLike::empty);
65 }
66 }