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

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

    • FunctionExpression

      protected FunctionExpression(SelectExpression target, @Nullable String alias, LabelGenerator labelGenerator)
      Constructor.
      Parameters:
      target - Target column expression to encapsulate.
      alias - The alias for the column expression
      labelGenerator - the label generator for rendering aliases/identifiers
  • Method Details

    • target

      public SelectExpression target()
      Description copied from interface: DelegateExpression
      Retrieves the target expression of this delegate.
      Specified by:
      target in interface DelegateExpression
      Returns:
      The target expression.
    • 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
      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