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 class
SqlColumn.Builder
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
alias
protected boolean
isDescending
protected java.sql.JDBCType
jdbcType
protected java.lang.String
name
protected ParameterTypeConverter<T,?>
parameterTypeConverter
protected RenderingStrategy
renderingStrategy
protected SqlTable
table
protected java.lang.String
typeHandler
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
alias()
Returns the columns alias if one has been specified.java.lang.String
aliasOrName()
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.java.lang.Object
convertParameterType(T value)
SortSpecification
descending()
Returns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.boolean
isDescending()
Return true if the sort order is descending.java.util.Optional<java.sql.JDBCType>
jdbcType()
java.lang.String
name()
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.util.Optional<RenderingStrategy>
renderingStrategy()
java.lang.String
renderWithTableAlias(TableAliasCalculator tableAliasCalculator)
Returns the name of the item aliased with a table name if appropriate.SqlTable
table()
java.util.Optional<java.lang.String>
typeHandler()
static SqlColumn.Builder
withName(java.lang.String name)
<S> SqlColumn<S>
withParameterTypeConverter(ParameterTypeConverter<S,?> parameterTypeConverter)
<S> SqlColumn<S>
withRenderingStrategy(RenderingStrategy renderingStrategy)
<S> SqlColumn<S>
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 final java.lang.String name
-
table
protected final SqlTable table
-
jdbcType
protected final java.sql.JDBCType jdbcType
-
isDescending
protected boolean isDescending
-
alias
protected java.lang.String alias
-
typeHandler
protected java.lang.String typeHandler
-
renderingStrategy
protected RenderingStrategy renderingStrategy
-
parameterTypeConverter
protected ParameterTypeConverter<T,?> parameterTypeConverter
-
-
Method Detail
-
name
public java.lang.String name()
-
table
public SqlTable table()
-
jdbcType
public java.util.Optional<java.sql.JDBCType> jdbcType()
- Specified by:
jdbcType
in interfaceBindableColumn<T>
-
alias
public java.util.Optional<java.lang.String> alias()
Description copied from interface:BasicColumn
Returns the columns alias if one has been specified.- Specified by:
alias
in interfaceBasicColumn
- Returns:
- the column alias
-
typeHandler
public java.util.Optional<java.lang.String> typeHandler()
- Specified by:
typeHandler
in interfaceBindableColumn<T>
-
convertParameterType
public java.lang.Object convertParameterType(T value)
- Specified by:
convertParameterType
in interfaceBindableColumn<T>
-
descending
public SortSpecification descending()
Description copied from interface:SortSpecification
Returns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.- Specified by:
descending
in interfaceSortSpecification
- Returns:
- new instance of SortSpecification
-
as
public SqlColumn<T> as(java.lang.String alias)
Description copied from interface:BindableColumn
Override the base method definition to make it more specific to this interface.- Specified by:
as
in interfaceBasicColumn
- Specified by:
as
in interfaceBindableColumn<T>
- Parameters:
alias
- the column alias to set- Returns:
- new instance with alias set
-
isDescending
public boolean isDescending()
Description copied from interface:SortSpecification
Return true if the sort order is descending.- Specified by:
isDescending
in interfaceSortSpecification
- Returns:
- true if the SortSpecification should render as descending
-
aliasOrName
public java.lang.String aliasOrName()
Description copied from interface:SortSpecification
Return the column alias or column name.- Specified by:
aliasOrName
in 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:BasicColumn
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.- Specified by:
renderWithTableAlias
in interfaceBasicColumn
- Parameters:
tableAliasCalculator
- the table alias calculator for the current renderer- Returns:
- the item name with the table alias applied
-
renderingStrategy
public java.util.Optional<RenderingStrategy> renderingStrategy()
- Specified by:
renderingStrategy
in interfaceBindableColumn<T>
-
withTypeHandler
@NotNull public <S> SqlColumn<S> withTypeHandler(java.lang.String typeHandler)
-
withRenderingStrategy
@NotNull public <S> SqlColumn<S> withRenderingStrategy(RenderingStrategy renderingStrategy)
-
withParameterTypeConverter
@NotNull public <S> SqlColumn<S> withParameterTypeConverter(ParameterTypeConverter<S,?> parameterTypeConverter)
-
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)
-
-