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

torand / FasterSQL / 16990059345

15 Aug 2025 12:34PM UTC coverage: 66.782% (-6.6%) from 73.399%
16990059345

push

github

torand
chore: access central snapshots

294 of 598 branches covered (49.16%)

Branch coverage included in aggregate %.

1638 of 2295 relevant lines covered (71.37%)

3.83 hits per line

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

57.14
/src/main/java/io/github/torand/fastersql/constant/Constants.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.constant;
17

18
import static java.util.Objects.isNull;
19

20
/**
21
 * Provides factory methods for constants.
22
 */
23
public final class Constants {
24

25
    private Constants() {}
26

27
    /**
28
     * Creates a scalar value constant.
29
     * @param value the constant value.
30
     * @return the constant.
31
     * @param <T> the constant type.
32
     */
33
    public static <T> Constant $(T value) {
34
        if (isNull(value)) {
3✔
35
            return nullValue();
2✔
36
        }
37

38
        return new GenericConstant<>(value, null);
6✔
39
    }
40

41
    /**
42
     * Creates a string inline constant.
43
     * @param value the constant value.
44
     * @return the constant.
45
     */
46
    public static Constant $i(String value) {
47
        if (isNull(value)) {
3!
48
            return nullValue();
×
49
        }
50

51
        return new InlineStringConstant(value, null);
6✔
52
    }
53

54
    /**
55
     * Creates a numeric inline constant.
56
     * @param value the constant value.
57
     * @return the constant.
58
     */
59
    public static Constant $i(Number value) {
60
        if (isNull(value)) {
3!
61
            return nullValue();
×
62
        }
63

64
        return new InlineNumberConstant(value, null);
6✔
65
    }
66

67
    /**
68
     * Creates a scalar value constant.
69
     * @param value the constant value.
70
     * @return the constant.
71
     * @param <T> the constant type.
72
     */
73
    public static <T> Constant constant(T value) {
74
        if (isNull(value)) {
×
75
            return nullValue();
×
76
        }
77

78
        return new GenericConstant<>(value, null);
×
79
    }
80

81
    /**
82
     * Creates a null constant.
83
     * @return the constant.
84
     */
85
    public static Constant nullValue() {
86
        return new NullConstant(null);
5✔
87
    }
88
}
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