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

mybatis / mybatis-dynamic-sql / 1491

13 Mar 2025 09:40PM UTC coverage: 99.923% (-0.08%) from 100.0%
1491

push

github

web-flow
Merge pull request #919 from jeffgbutler/make-less-garbage

Little optimization that creates less garbage

199 of 200 branches covered (99.5%)

Branch coverage included in aggregate %.

10 of 10 new or added lines in 6 files covered. (100.0%)

3 existing lines in 3 files now uncovered.

4990 of 4993 relevant lines covered (99.94%)

1.0 hits per line

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

90.91
/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitiveWhenPresent.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.Objects;
22
import java.util.function.Predicate;
23
import java.util.function.UnaryOperator;
24

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

28
public class IsNotInCaseInsensitiveWhenPresent extends AbstractListValueCondition<String>
29
        implements CaseInsensitiveRenderableCondition {
30
    private static final IsNotInCaseInsensitiveWhenPresent EMPTY =
1✔
31
            new IsNotInCaseInsensitiveWhenPresent(Collections.emptyList());
1✔
32

33
    public static IsNotInCaseInsensitiveWhenPresent empty() {
34
        return EMPTY;
1✔
35
    }
36

37
    protected IsNotInCaseInsensitiveWhenPresent(Collection<String> values) {
38
        super(values);
1✔
39
    }
1✔
40

41
    @Override
42
    public String operator() {
43
        return "not in"; //$NON-NLS-1$
1✔
44
    }
45

46
    @Override
47
    public IsNotInCaseInsensitiveWhenPresent filter(Predicate<? super String> predicate) {
48
        return filterSupport(predicate, IsNotInCaseInsensitiveWhenPresent::new,
1✔
49
                this, IsNotInCaseInsensitiveWhenPresent::empty);
50
    }
51

52
    /**
53
     * If not empty, apply the mapping to each value in the list return a new condition with the mapped values.
54
     *     Else return an empty condition (this).
55
     *
56
     * @param mapper a mapping function to apply to the values, if not empty
57
     * @return a new condition with mapped values if renderable, otherwise an empty condition
58
     */
59
    public IsNotInCaseInsensitiveWhenPresent map(UnaryOperator<String> mapper) {
UNCOV
60
        return mapSupport(mapper, IsNotInCaseInsensitiveWhenPresent::new, IsNotInCaseInsensitiveWhenPresent::empty);
×
61
    }
62

63
    public static IsNotInCaseInsensitiveWhenPresent of(@Nullable String... values) {
64
        return of(Arrays.asList(values));
1✔
65
    }
66

67
    public static IsNotInCaseInsensitiveWhenPresent of(Collection<@Nullable String> values) {
68
        return new IsNotInCaseInsensitiveWhenPresent(
1✔
69
                values.stream().filter(Objects::nonNull).map(String::toUpperCase).toList());
1✔
70
    }
71
}
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