Class TransformedSqlColumn

java.lang.Object
com.randomnoun.common.jexl.sql.SqlColumn
com.randomnoun.common.jexl.sql.TransformedSqlColumn

public abstract class TransformedSqlColumn extends SqlColumn
An SQL column which represents a transformed value ( the value in the expression is not the stored value ).

Examples of TransformedSqlColumns:

  • enum values ( 1-char in database exposed as enum strings )
  • yes/no values ( 'Y'/'N' in database exposed as booleans )
  • api-prefixed values ( 1234 in database exposed as "obj-1234" )

If the transformation is reversible, we can convert some expressions to use the raw column which can then leverage indexes on that column.

  • Constructor Details

  • Method Details

    • isNullPreserved

      public abstract boolean isNullPreserved()
      If true, we can perform null checks on the source column instead of the transformed value
    • isReversableEquals

      public abstract boolean isReversableEquals()
      If true, we can reverse transformations for equals and not-equals comparisons
    • isReversableComparison

      public abstract boolean isReversableComparison()
      If true, we can reverse transformations for comparison operations; we can only do this if transformations preserve ordering
    • getSourceSqlColumn

      public abstract SqlColumn getSourceSqlColumn()
      The source column
    • reverseTransformLiteral

      Reverse the transformation, i.e. convert a user-supplied value back into a database value. The user-supplied value must be a literal (String, Boolean, Long etc), not an expression.
      Parameters:
      value - literal value in expression
      Throws:
      CannotReverseTransformationException