public class SqlColumn<T> extends Object implements BindableColumn<T>, SortSpecification
Modifier and Type | Class and Description |
---|---|
static class |
SqlColumn.Builder<T> |
Modifier and Type | Field and Description |
---|---|
protected String |
alias |
protected boolean |
isDescending |
protected JDBCType |
jdbcType |
protected String |
name |
protected ParameterTypeConverter<T,?> |
parameterTypeConverter |
protected RenderingStrategy |
renderingStrategy |
protected SqlTable |
table |
protected BiFunction<TableAliasCalculator,SqlTable,Optional<String>> |
tableQualifierFunction |
protected String |
typeHandler |
Modifier and Type | Method and Description |
---|---|
Optional<String> |
alias()
Returns the columns alias if one has been specified.
|
SqlColumn<T> |
as(String alias)
Override the base method definition to make it more specific to this interface.
|
SqlColumn<T> |
asCamelCase()
Set an alias with a camel cased string based on the column name.
|
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.
|
Optional<JDBCType> |
jdbcType() |
String |
name() |
static <T> SqlColumn<T> |
of(String name,
SqlTable table) |
static <T> SqlColumn<T> |
of(String name,
SqlTable table,
JDBCType jdbcType) |
String |
orderByName()
Return the phrase that should be written into a rendered order by clause.
|
SqlColumn<T> |
qualifiedWith(String tableQualifier)
Override the calculated table qualifier if there is one.
|
Optional<RenderingStrategy> |
renderingStrategy() |
String |
renderWithTableAlias(TableAliasCalculator tableAliasCalculator)
Returns the name of the item aliased with a table name if appropriate.
|
SqlTable |
table() |
Optional<String> |
typeHandler() |
<S> SqlColumn<S> |
withParameterTypeConverter(ParameterTypeConverter<S,?> parameterTypeConverter) |
<S> SqlColumn<S> |
withRenderingStrategy(RenderingStrategy renderingStrategy) |
<S> SqlColumn<S> |
withTypeHandler(String typeHandler) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
columnList, renderWithTableAndColumnAlias
protected final String name
protected final SqlTable table
protected final JDBCType jdbcType
protected final boolean isDescending
protected final String alias
protected final String typeHandler
protected final RenderingStrategy renderingStrategy
protected final ParameterTypeConverter<T,?> parameterTypeConverter
protected final BiFunction<TableAliasCalculator,SqlTable,Optional<String>> tableQualifierFunction
public String name()
public SqlTable table()
public Optional<JDBCType> jdbcType()
jdbcType
in interface BindableColumn<T>
public Optional<String> alias()
BasicColumn
alias
in interface BasicColumn
public Optional<String> typeHandler()
typeHandler
in interface BindableColumn<T>
public Object convertParameterType(T value)
convertParameterType
in interface BindableColumn<T>
public SortSpecification descending()
SortSpecification
descending
in interface SortSpecification
public SqlColumn<T> as(String alias)
BindableColumn
as
in interface BasicColumn
as
in interface BindableColumn<T>
alias
- the column alias to setpublic SqlColumn<T> qualifiedWith(String tableQualifier)
tableQualifier
- the table qualifier to apply to the rendered column namepublic SqlColumn<T> asCamelCase()
CommonSelectMapper
where the columns are placed into
a map based on the column name returned from the database.
A camel case string is mixed case, and most databases do not support unquoted mixed case strings as identifiers. Therefore the generated alias will be surrounded by double quotes thereby making it a quoted identifier. Most databases will respect quoted mixed case identifiers.
public boolean isDescending()
SortSpecification
isDescending
in interface SortSpecification
public String orderByName()
SortSpecification
orderByName
in interface SortSpecification
public String renderWithTableAlias(TableAliasCalculator tableAliasCalculator)
BasicColumn
renderWithTableAlias
in interface BasicColumn
tableAliasCalculator
- the table alias calculator for the current rendererpublic Optional<RenderingStrategy> renderingStrategy()
renderingStrategy
in interface BindableColumn<T>
@NotNull public <S> SqlColumn<S> withRenderingStrategy(RenderingStrategy renderingStrategy)
@NotNull public <S> SqlColumn<S> withParameterTypeConverter(ParameterTypeConverter<S,?> parameterTypeConverter)
Copyright © 2016–2021 MyBatis.org. All rights reserved.