Class LiteralExpressionImpl

All Implemented Interfaces:
AliasedExpression, LiteralExpression, SelectExpression

public class LiteralExpressionImpl extends AbstractAliasedExpression implements LiteralExpression
An encapsulated literal value in a query expression.
  • Constructor Details

    • LiteralExpressionImpl

      public LiteralExpressionImpl(@Nullable Object value, @Nullable String alias, LabelGenerator labelGenerator)
      Constructs a new LiteralExpressionImpl with the given value.
      Parameters:
      value - the literal value to be represented
      labelGenerator - generator for rendering aliases/identifiers
    • LiteralExpressionImpl

      public LiteralExpressionImpl(@Nullable Object value, LabelGenerator labelGenerator)
      Constructs a new LiteralExpressionImpl with the given value and no alias.
      Parameters:
      value - the literal value to be represented
      labelGenerator - generator for rendering aliases/identifiers
  • Method Details

    • value

      public @Nullable Object value()
      Description copied from interface: LiteralExpression
      Retrieves the value of this literal expression.
      Specified by:
      value in interface LiteralExpression
      Returns:
      the literal value encapsulated by this expression
    • toSql

      public String toSql(Operation operation, ClauseType clause, @Nullable DelegateExpression parent)
      Description copied from interface: SelectExpression
      Creates a SQL representation of the expression, providing the immediate nesting/parent expression.
      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
    • toBindValueSql

      public String toBindValueSql(ClauseType clause)
      Generates a SQL fragment with a placeholder for a bind value.
      Parameters:
      clause - the query clause type
      Returns:
      the SQL fragment with bind placeholders
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class AbstractAliasedExpression
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractAliasedExpression
    • toString

      public String toString()
      Overrides:
      toString in class AbstractAliasedExpression