Package org.mybatis.dynamic.sql
Class SqlColumn<T>
- java.lang.Object
-
- org.mybatis.dynamic.sql.SqlColumn<T>
-
- All Implemented Interfaces:
BasicColumn,BindableColumn<T>,SortSpecification
public class SqlColumn<T> extends java.lang.Object implements BindableColumn<T>, SortSpecification
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSqlColumn.Builder
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringaliasprotected booleanisDescendingprotected java.sql.JDBCTypejdbcTypeprotected java.lang.Stringnameprotected SqlTabletableprotected java.lang.StringtypeHandler
-
Method Summary
Modifier and Type Method Description java.util.Optional<java.lang.String>alias()Returns the columns alias if one has been specified.java.lang.StringaliasOrName()Return the column alias or column name.SqlColumn<T>as(java.lang.String alias)Override the base method definition to make it more specific to this interface.SortSpecificationdescending()Returns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.booleanisDescending()Return true if the sort order is descending.java.util.Optional<java.sql.JDBCType>jdbcType()java.lang.Stringname()static <T> SqlColumn<T>of(java.lang.String name, SqlTable table)static <T> SqlColumn<T>of(java.lang.String name, SqlTable table, java.sql.JDBCType jdbcType)java.lang.StringrenderWithTableAlias(TableAliasCalculator tableAliasCalculator)Returns the name of the item aliased with a table name if appropriate.java.util.Optional<java.lang.String>typeHandler()static SqlColumn.BuilderwithName(java.lang.String name)SqlColumn<T>withTypeHandler(java.lang.String typeHandler)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mybatis.dynamic.sql.BasicColumn
renderWithTableAndColumnAlias
-
-
-
-
Field Detail
-
name
protected java.lang.String name
-
table
protected SqlTable table
-
jdbcType
protected java.sql.JDBCType jdbcType
-
isDescending
protected boolean isDescending
-
alias
protected java.lang.String alias
-
typeHandler
protected java.lang.String typeHandler
-
-
Constructor Detail
-
SqlColumn
protected SqlColumn(SqlColumn<?> sqlColumn)
-
-
Method Detail
-
name
public java.lang.String name()
-
jdbcType
public java.util.Optional<java.sql.JDBCType> jdbcType()
- Specified by:
jdbcTypein interfaceBindableColumn<T>
-
alias
public java.util.Optional<java.lang.String> alias()
Description copied from interface:BasicColumnReturns the columns alias if one has been specified.- Specified by:
aliasin interfaceBasicColumn- Returns:
- the column alias
-
typeHandler
public java.util.Optional<java.lang.String> typeHandler()
- Specified by:
typeHandlerin interfaceBindableColumn<T>
-
descending
public SortSpecification descending()
Description copied from interface:SortSpecificationReturns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.- Specified by:
descendingin interfaceSortSpecification- Returns:
- new instance of SortSpecification
-
as
public SqlColumn<T> as(java.lang.String alias)
Description copied from interface:BindableColumnOverride the base method definition to make it more specific to this interface.- Specified by:
asin interfaceBasicColumn- Specified by:
asin interfaceBindableColumn<T>- Parameters:
alias- the column alias to set- Returns:
- new instance with alias set
-
isDescending
public boolean isDescending()
Description copied from interface:SortSpecificationReturn true if the sort order is descending.- Specified by:
isDescendingin interfaceSortSpecification- Returns:
- true if the SortSpcification should render as descending
-
aliasOrName
public java.lang.String aliasOrName()
Description copied from interface:SortSpecificationReturn the column alias or column name.- Specified by:
aliasOrNamein interfaceSortSpecification- Returns:
- the column alias if one has been specified by the user, or else the column name
-
renderWithTableAlias
public java.lang.String renderWithTableAlias(TableAliasCalculator tableAliasCalculator)
Description copied from interface:BasicColumnReturns 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.- Specified by:
renderWithTableAliasin interfaceBasicColumn- Parameters:
tableAliasCalculator- the table alias calculator for the current renderer- Returns:
- the item name with the table alias applied
-
of
public static <T> SqlColumn<T> of(java.lang.String name, SqlTable table, java.sql.JDBCType jdbcType)
-
withName
public static SqlColumn.Builder withName(java.lang.String name)
-
-