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

torand / FasterSQL / 15071216480

16 May 2025 02:49PM UTC coverage: 69.877% (+2.4%) from 67.475%
15071216480

push

github

web-flow
Merge pull request #30 from torand/access-support

Access support

229 of 414 branches covered (55.31%)

Branch coverage included in aggregate %.

105 of 152 new or added lines in 26 files covered. (69.08%)

3 existing lines in 3 files now uncovered.

1193 of 1621 relevant lines covered (73.6%)

3.92 hits per line

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

16.67
/src/main/java/io/github/torand/fastersql/predicate/Predicate.java
1
/*
2
 * Copyright (c) 2024-2025 Tore Eide Andersen
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
 *      http://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 io.github.torand.fastersql.predicate;
17

18
import io.github.torand.fastersql.Context;
19
import io.github.torand.fastersql.Sql;
20
import io.github.torand.fastersql.predicate.compound.CompoundPredicates;
21

22
/**
23
 * Defines a restriction on the rows fetched by a SELECT or affected by an UPDATE or DELETE.
24
 */
25
public interface Predicate extends Sql {
26
    /**
27
     * Formats negated predicate as an SQL fragment.
28
     * @param context the context (incl. dialect).
29
     * @return the formatted SQL fragment.
30
     */
31
    String negatedSql(Context context);
32

33
    /**
34
     * Creates a compound predicate using the boolean operator OR on this predicate and the specified predicate.
35
     * @param other the other predicate.
36
     * @return the compound predicate.
37
     */
38
    default Predicate or(Predicate other) {
39
        return CompoundPredicates.or(this, other);
12✔
40
    }
41

42
    /**
43
     * Creates an optional compound predicate using the boolean operator OR on this predicate and the specified optional predicate.
44
     * @param optionalOther the other optional predicate
45
     * @return the optional compound predicate.
46
     */
47
    default OptionalPredicate or(OptionalPredicate optionalOther) {
NEW
48
        if (optionalOther.isPresent()) {
×
NEW
49
            return OptionalPredicate.of(CompoundPredicates.or(this, optionalOther.get()));
×
50
        } else {
51
            return OptionalPredicate.of(this);
×
52
        }
53
    }
54

55
    /**
56
     * Creates a compound predicate using the boolean operator AND on this predicate and the specified predicate.
57
     * @param other the other predicate.
58
     * @return the compound predicate.
59
     */
60
    default Predicate and(Predicate other) {
61
        return CompoundPredicates.and(this, other);
12✔
62
    }
63

64
    /**
65
     * Creates an optional compound predicate using the boolean operator AND on this predicate and the specified optional predicate.
66
     * @param optionalOther the other optional predicate
67
     * @return the optional compound predicate.
68
     */
69
    default OptionalPredicate and(OptionalPredicate optionalOther) {
NEW
70
        if (optionalOther.isPresent()) {
×
NEW
71
            return OptionalPredicate.of(CompoundPredicates.and(this, optionalOther.get()));
×
72
        } else {
73
            return OptionalPredicate.of(this);
×
74
        }
75
    }
76
}
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

© 2026 Coveralls, Inc