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

mybatis / mybatis-dynamic-sql / #1871

17 Aug 2024 07:29PM CUT coverage: 100.0%. Remained the same
#1871

Pull #841

github

web-flow
Update dependency maven to v3.9.9
Pull Request #841: Update dependency maven to v3.9.9

158 of 158 branches covered (100.0%)

Branch coverage included in aggregate %.

4995 of 4995 relevant lines covered (100.0%)

1.0 hits per line

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

100.0
/src/main/java/org/mybatis/dynamic/sql/BasicColumn.java
1
/*
2
 *    Copyright 2016-2024 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;
17

18
import java.sql.JDBCType;
19
import java.util.Optional;
20

21
import org.mybatis.dynamic.sql.render.RenderingContext;
22
import org.mybatis.dynamic.sql.render.RenderingStrategy;
23
import org.mybatis.dynamic.sql.util.FragmentAndParameters;
24

25
/**
26
 * Describes attributes of columns that are necessary for rendering if the column is not expected to
27
 * be bound as a JDBC parameter.  Columns in select lists, join expressions, and group by expressions
28
 * are typically not bound.
29
 *
30
 * @author Jeff Butler
31
 */
32
public interface BasicColumn {
33

34
    /**
35
     * Returns the columns alias if one has been specified.
36
     *
37
     * @return the column alias
38
     */
39
    Optional<String> alias();
40

41
    /**
42
     * Returns a new instance of a BasicColumn with the alias set.
43
     *
44
     * @param alias
45
     *            the column alias to set
46
     *
47
     * @return new instance with alias set
48
     */
49
    BasicColumn as(String alias);
50

51
    /**
52
     * Returns a rendering of the column.
53
     * The rendered fragment should include the table alias based on the TableAliasCalculator
54
     * in the RenderingContext. The fragment could contain prepared statement parameter
55
     * markers and associated parameter values if desired.
56
     *
57
     * @param renderingContext the rendering context (strategy, sequence, etc.)
58
     * @return a rendered SQL fragment and, optionally, parameters associated with the fragment
59
     * @since 1.5.1
60
     */
61
    FragmentAndParameters render(RenderingContext renderingContext);
62

63
    default Optional<JDBCType> jdbcType() {
64
        return Optional.empty();
1✔
65
    }
66

67
    default Optional<String> typeHandler() {
68
        return Optional.empty();
1✔
69
    }
70

71
    default Optional<RenderingStrategy> renderingStrategy() {
72
        return Optional.empty();
1✔
73
    }
74

75
    /**
76
     * Utility method to make it easier to build column lists for methods that require an
77
     * array rather than the varargs method.
78
     *
79
     * @param columns list of BasicColumn
80
     * @return an array of BasicColumn
81
     */
82
    static BasicColumn[] columnList(BasicColumn... columns) {
83
        return columns;
1✔
84
    }
85
}
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