Class FunctionExpression

All Implemented Interfaces:
ColumnExpression, DelegateExpression, SelectExpression
Direct Known Subclasses:
Abs, Avg, Lower, Max, Min, Substring, Upper

public abstract class FunctionExpression extends DelegateColumnExpressionImpl
Base class for function expressions operating on a column.
  • Constructor Details

    • FunctionExpression

      public FunctionExpression(ColumnExpression target, ColumnIdentifierGenerator columnIdentifierGenerator)
      Constructor.
      Parameters:
      target - Target column expression to encapsulate.
      columnIdentifierGenerator - Database provider-specific column identifier generator.
  • Method Details

    • toSql

      public String toSql(Operation operation, ClauseType clause, @Nullable DelegateExpression parent)
      Creates a SQL representation of the expression.

      This is usually used for expressions that do not require any aliases.

      Specified by:
      toSql in interface SelectExpression
      Overrides:
      toSql in class DelegateColumnExpressionImpl
      Parameters:
      operation - the operation that is being executed
      clause - The current clause type being evaluated
      parent - The parent expression/nesting expression, or null if this is a top-level expression
      Returns:
      the SQL representation of the expression
    • template

      protected abstract String template()
      Gets the template for the SQL representation of the function.

      The template should contain a single "%s" placeholder for the column identifier.

      Returns:
      SQL representation template