• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mybatis / mybatis-dynamic-sql / 1495

14 Mar 2025 05:02PM UTC coverage: 99.923%. Remained the same
1495

Pull #921

github

web-flow
Merge 1df401a0c into 337569179
Pull Request #921: Condition Filter and Map are now Interfaces

199 of 200 branches covered (99.5%)

Branch coverage included in aggregate %.

47 of 49 new or added lines in 11 files covered. (95.92%)

2 existing lines in 2 files now uncovered.

4992 of 4995 relevant lines covered (99.94%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitiveWhenPresent.java
1
/*
2
 *    Copyright 2016-2025 the original author or authors.
3
 *
4
 *    Licensed under the Apache License, Version 2.0 (the "License");
5
 *    you may not use this file except in compliance with the License.
6
 *    You may obtain a copy of the License at
7
 *
8
 *       https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *    Unless required by applicable law or agreed to in writing, software
11
 *    distributed under the License is distributed on an "AS IS" BASIS,
12
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *    See the License for the specific language governing permissions and
14
 *    limitations under the License.
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.function.Function;
22
import java.util.Objects;
23
import java.util.function.Predicate;
24

25
import org.jspecify.annotations.Nullable;
26
import org.mybatis.dynamic.sql.AbstractListValueCondition;
27

28
public class IsInCaseInsensitiveWhenPresent<T> extends AbstractListValueCondition<T>
29
        implements CaseInsensitiveRenderableCondition<T>, AbstractListValueCondition.Filterable<T>,
30
        AbstractListValueCondition.Mappable<T> {
31
    private static final IsInCaseInsensitiveWhenPresent<?> EMPTY =
1✔
32
            new IsInCaseInsensitiveWhenPresent<>(Collections.emptyList());
1✔
33

34
    public static <T> IsInCaseInsensitiveWhenPresent<T> empty() {
35
        @SuppressWarnings("unchecked")
36
        IsInCaseInsensitiveWhenPresent<T> t = (IsInCaseInsensitiveWhenPresent<T>) EMPTY;
1✔
37
        return t;
1✔
38
    }
39

40
    protected IsInCaseInsensitiveWhenPresent(Collection<T> values) {
41
        super(values);
1✔
42
    }
1✔
43

44
    @Override
45
    public String operator() {
46
        return "in"; //$NON-NLS-1$
1✔
47
    }
48

49
    @Override
50
    public IsInCaseInsensitiveWhenPresent<T> filter(Predicate<? super T> predicate) {
51
        return filterSupport(predicate, IsInCaseInsensitiveWhenPresent::new, this,
1✔
52
                IsInCaseInsensitiveWhenPresent::empty);
53
    }
54

55
    @Override
56
    public <R> IsInCaseInsensitiveWhenPresent<R> map(Function<? super T, ? extends R> mapper) {
NEW
UNCOV
57
        return mapSupport(mapper, IsInCaseInsensitiveWhenPresent::new, IsInCaseInsensitiveWhenPresent::empty);
×
58
    }
59

60
    public static IsInCaseInsensitiveWhenPresent<String> of(@Nullable String... values) {
61
        return of(Arrays.asList(values));
1✔
62
    }
63

64
    public static IsInCaseInsensitiveWhenPresent<String> of(Collection<@Nullable String> values) {
65
        return new IsInCaseInsensitiveWhenPresent<>(
1✔
66
                values.stream().filter(Objects::nonNull).map(String::toUpperCase).toList());
1✔
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc