Class ConvertExpression

java.lang.Object
org.litebridgedb.db.spi.expression.ConvertExpression
All Implemented Interfaces:
DelegateExpression, SelectExpression

public class ConvertExpression extends Object implements DelegateExpression
Represents a conversion expression that wraps another SelectExpression, potentially overriding its type.

This class serves as a decorator around a target SelectExpression, allowing for an optional type override. It delegates SQL generation to the encapsulated target expression.

  • Constructor Details

    • ConvertExpression

      public ConvertExpression(SelectExpression target, Class<?> typeOverride)
      Constructor.
      Parameters:
      target - The encapsulated target column expression for this expression.
  • Method Details

    • toSql

      public String toSql(Operation operation)
      Description copied from interface: SelectExpression
      Creates a SQL representation of the expression.
      Specified by:
      toSql in interface SelectExpression
      Parameters:
      operation - the operation that is being executed
      Returns:
      the SQL representation of the expression
    • 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.
    • typeOverride

      public Class<?> typeOverride()
      Retrieves the class type that overrides the default type of the wrapped SelectExpression.
      Returns:
      The type override, or null if no override is specified.