Class DerivedColumn<T>

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 and SqlColumn is that this class does not have a related SqlTable and 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.
  • Constructor Details

  • Method Details

    • alias

      public Optional<String> alias()
      Description copied from interface: BasicColumn
      Returns the columns alias if one has been specified.
      Specified by:
      alias in interface BasicColumn
      Returns:
      the column alias
    • jdbcType

      public Optional<JDBCType> jdbcType()
      Specified by:
      jdbcType in interface BindableColumn<T>
    • typeHandler

      public Optional<String> typeHandler()
      Specified by:
      typeHandler in interface BindableColumn<T>
    • render

      public FragmentAndParameters render(RenderingContext renderingContext)
      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 interface BasicColumn
      Parameters:
      renderingContext - the rendering context (strategy, sequence, etc.)
      Returns:
      a rendered SQL fragment and, optionally, parameters associated with the fragment
    • as

      public DerivedColumn<T> as(String columnAlias)
      Description copied from interface: BindableColumn
      Override the base method definition to make it more specific to this interface.
      Specified by:
      as in interface BasicColumn
      Specified by:
      as in interface BindableColumn<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)