Package org.mybatis.dynamic.sql
Class SqlColumn<T>
java.lang.Object
org.mybatis.dynamic.sql.SqlColumn<T>
- All Implemented Interfaces:
BasicColumn
,BindableColumn<T>
,SortSpecification
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final boolean
protected final JDBCType
protected final String
protected final ParameterTypeConverter
<T, ?> protected final RenderingStrategy
protected final SqlTable
protected final String
protected final String
-
Method Summary
Modifier and TypeMethodDescriptionalias()
Returns the columns alias if one has been specified.Override the base method definition to make it more specific to this interface.Set an alias with a camel cased string based on the column name.convertParameterType
(T value) Returns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.boolean
Return true if the sort order is descending.javaType()
jdbcType()
name()
static <T> SqlColumn
<T> static <T> SqlColumn
<T> Return the phrase that should be written into a rendered order by clause.qualifiedWith
(String tableQualifier) Override the calculated table qualifier if there is one.render
(RenderingContext renderingContext) Returns a rendering of the column.table()
<S> SqlColumn
<S> withJavaType
(Class<S> javaType) <S> SqlColumn
<S> withParameterTypeConverter
(ParameterTypeConverter<S, ?> parameterTypeConverter) <S> SqlColumn
<S> withRenderingStrategy
(RenderingStrategy renderingStrategy) <S> SqlColumn
<S> withTypeHandler
(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
renderWithTableAlias
-
Field Details
-
name
-
table
-
jdbcType
-
isDescending
protected final boolean isDescending -
alias
-
typeHandler
-
renderingStrategy
-
parameterTypeConverter
-
tableQualifier
-
javaType
-
-
Method Details
-
name
-
table
-
jdbcType
- Specified by:
jdbcType
in interfaceBindableColumn<T>
-
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
- Specified by:
typeHandler
in interfaceBindableColumn<T>
-
javaType
- Specified by:
javaType
in interfaceBindableColumn<T>
-
convertParameterType
- Specified by:
convertParameterType
in interfaceBindableColumn<T>
-
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
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
-
qualifiedWith
Override the calculated table qualifier if there is one. This is useful for sub-queries where the calculated table qualifier may not be correct in all cases.- Parameters:
tableQualifier
- the table qualifier to apply to the rendered column name- Returns:
- a new column that will be rendered with the specified table qualifier
-
asCamelCase
Set an alias with a camel cased string based on the column name. This can be useful for queries using theCommonSelectMapper
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.
- Returns:
- a new column aliased with a camel case version of the column name
-
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
-
orderByName
Description copied from interface:SortSpecification
Return the phrase that should be written into a rendered order by clause. This should NOT include the "DESC" word for descending sort specifications.- Specified by:
orderByName
in interfaceSortSpecification
- Returns:
- the order by phrase
-
render
Description copied from interface:BasicColumn
Returns a rendering of the column. The rendered fragment should include the table alias based on the TableAliasCalculator in the RenderingContext. The fragment could contain prepared statement parameter markers and associated parameter values if desired.- Specified by:
render
in interfaceBasicColumn
- Parameters:
renderingContext
- the rendering context (strategy, sequence, etc.)- Returns:
- a rendered SQL fragment and, optionally, parameters associated with the fragment
-
renderingStrategy
- Specified by:
renderingStrategy
in interfaceBindableColumn<T>
-
withTypeHandler
-
withRenderingStrategy
-
withParameterTypeConverter
@NotNull public <S> SqlColumn<S> withParameterTypeConverter(ParameterTypeConverter<S, ?> parameterTypeConverter) -
withJavaType
-
of
-
of
-