Package org.mybatis.dynamic.sql
Interface BasicColumn
-
- All Known Subinterfaces:
BindableColumn<T>
- All Known Implementing Classes:
AbstractAggregate,AbstractFunction,AbstractMultipleColumnArithmeticFunction,Add,Avg,Constant,Count,CountAll,CountDistinct,Divide,Lower,Max,Min,Multiply,SqlColumn,StringConstant,Substring,Subtract,Sum,Upper
public interface BasicColumnDescribes attributes of columns that are necessary for rendering if the column is not expected to be bound as a JDBC parameter. Columns in select lists, join expressions, and group by expressions are typically not bound.- Author:
- Jeff Butler
-
-
Method Summary
Modifier and Type Method Description java.util.Optional<java.lang.String>alias()Returns the columns alias if one has been specified.BasicColumnas(java.lang.String alias)Returns a new instance of a BasicColumn with the alias set.static BasicColumn[]columnList(BasicColumn... columns)Utility method to make it easier to build column lists for methods that require an array rather than the varargs method.java.lang.StringrenderWithTableAlias(TableAliasCalculator tableAliasCalculator)Returns the name of the item aliased with a table name if appropriate.default java.lang.StringrenderWithTableAndColumnAlias(TableAliasCalculator tableAliasCalculator)Returns the name of the item aliased with a table name and column alias if appropriate.
-
-
-
Method Detail
-
alias
java.util.Optional<java.lang.String> alias()
Returns the columns alias if one has been specified.- Returns:
- the column alias
-
as
BasicColumn as(java.lang.String alias)
Returns a new instance of a BasicColumn with the alias set.- Parameters:
alias- the column alias to set- Returns:
- new instance with alias set
-
renderWithTableAlias
java.lang.String renderWithTableAlias(TableAliasCalculator tableAliasCalculator)
Returns the name of the item aliased with a table name if appropriate. For example, "a.foo". This is appropriate for where clauses and order by clauses.- Parameters:
tableAliasCalculator- the table alias calculator for the current renderer- Returns:
- the item name with the table alias applied
-
renderWithTableAndColumnAlias
default java.lang.String renderWithTableAndColumnAlias(TableAliasCalculator tableAliasCalculator)
Returns the name of the item aliased with a table name and column alias if appropriate. For example, "a.foo as bar". This is appropriate for select list clauses.- Parameters:
tableAliasCalculator- the table alias calculator for the current renderer- Returns:
- the item name with the table and column aliases applied
-
columnList
static BasicColumn[] columnList(BasicColumn... columns)
Utility method to make it easier to build column lists for methods that require an array rather than the varargs method.- Parameters:
columns- list of BasicColumn- Returns:
- an array of BasicColumn
-
-