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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final @Nullable Stringprotected final Stringprotected final @Nullable JDBCTypeprotected final Stringprotected final ParameterTypeConverter<T, ?> protected final @Nullable RenderingStrategyprotected final SqlTableprotected final @Nullable Stringprotected final @Nullable 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.@Nullable ObjectconvertParameterType(@Nullable T value) Returns a new instance of the SortSpecification that should render as descending in an ORDER BY clause.javaType()jdbcType()name()static <T> SqlColumn<T> static <T> SqlColumn<T> qualifiedWith(String tableQualifier) Override the calculated table qualifier if there is one.render(RenderingContext renderingContext) Returns a rendering of the column.renderForOrderBy(RenderingContext renderingContext) Return a fragment rendered for use in an ORDER BY clause.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)
-
Field Details
-
name
-
table
-
jdbcType
-
descendingPhrase
-
alias
-
typeHandler
-
renderingStrategy
-
parameterTypeConverter
-
tableQualifier
-
javaType
-
-
Method Details
-
name
-
table
-
jdbcType
- Specified by:
jdbcTypein interfaceBasicColumn
-
alias
Description copied from interface:BasicColumnReturns the columns alias if one has been specified.- Specified by:
aliasin interfaceBasicColumn- Returns:
- the column alias
-
typeHandler
- Specified by:
typeHandlerin interfaceBasicColumn
-
javaType
- Specified by:
javaTypein interfaceBindableColumn<T>
-
convertParameterType
- Specified by:
convertParameterTypein interfaceBindableColumn<T>
-
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
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
-
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 theCommonSelectMapperwhere 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
-
renderForOrderBy
Description copied from interface:SortSpecificationReturn a fragment rendered for use in an ORDER BY clause. The fragment should include "DESC" if a descending order is desired.- Specified by:
renderForOrderByin interfaceSortSpecification- Parameters:
renderingContext- the current rendering context- Returns:
- a rendered fragment and parameters if applicable
-
render
Description copied from interface:BasicColumnReturns 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:
renderin interfaceBasicColumn- Parameters:
renderingContext- the rendering context (strategy, sequence, etc.)- Returns:
- a rendered SQL fragment and, optionally, parameters associated with the fragment
-
renderingStrategy
- Specified by:
renderingStrategyin interfaceBasicColumn
-
withTypeHandler
-
withRenderingStrategy
-
withParameterTypeConverter
public <S> SqlColumn<S> withParameterTypeConverter(ParameterTypeConverter<S, ?> parameterTypeConverter) -
withJavaType
-
of
-
of
-