- java.lang.Object
-
- org.mybatis.dynamic.sql.DerivedColumn<T>
-
- Type Parameters:
T- The Java type that corresponds to this column - not used except for compiler type checking for conditions
- All Implemented Interfaces:
BasicColumn,BindableColumn<T>
public class DerivedColumn<T> extends Object implements BindableColumn<T>
A derived column is a column that is not directly related to a table. This is primarily used for supporting sub-queries. The main difference in this class andSqlColumnis that this class does not have a relatedSqlTableand therefore ignores any table qualifier set in a query. If a table qualifier is required it can be set directly in the builder for this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDerivedColumn.Builder<T>
-
Constructor Summary
Constructors Modifier Constructor Description protectedDerivedColumn(DerivedColumn.Builder<T> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>alias()Returns the columns alias if one has been specified.DerivedColumn<T>as(String columnAlias)Override the base method definition to make it more specific to this interface.Optional<JDBCType>jdbcType()static <T> DerivedColumn<T>of(String name)static <T> DerivedColumn<T>of(String name, String tableQualifier)StringrenderWithTableAlias(TableAliasCalculator tableAliasCalculator)Returns the name of the item aliased with a table name if appropriate.Optional<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
-
Methods inherited from interface org.mybatis.dynamic.sql.BindableColumn
convertParameterType, javaType, renderingStrategy
-
-
-
-
Constructor Detail
-
DerivedColumn
protected DerivedColumn(DerivedColumn.Builder<T> builder)
-
-
Method Detail
-
alias
public Optional<String> alias()
Description copied from interface:BasicColumnReturns the columns alias if one has been specified.- Specified by:
aliasin interfaceBasicColumn- Returns:
- the column alias
-
jdbcType
public Optional<JDBCType> jdbcType()
- Specified by:
jdbcTypein interfaceBindableColumn<T>
-
typeHandler
public Optional<String> typeHandler()
- Specified by:
typeHandlerin interfaceBindableColumn<T>
-
renderWithTableAlias
public 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
-
as
public DerivedColumn<T> as(String columnAlias)
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:
columnAlias- the column alias to set- Returns:
- new instance with alias set
-
of
public static <T> DerivedColumn<T> of(String name)
-
of
public static <T> DerivedColumn<T> of(String name, String tableQualifier)
-
-