Class DBCaseExpr

All Implemented Interfaces:
ColumnExpr
Direct Known Subclasses:
DBCaseMapExpr, DBCaseWhenExpr

public abstract class DBCaseExpr extends DBColumnExpr
This class represents a SQL case expression like "case when ?=A then X else Y end" or "case ? when A then X else Y end"

This abstract class is implemented by DBCaseMapExpr and DBCaseWhenExpr

Author:
doebele
  • Constructor Details

  • Method Details

    • getDatabase

      public final DBDatabase getDatabase()
      Description copied from class: DBObject
      Returns the database object to which this object belongs to. For the database object itself this function will return the this pointer.
      Specified by:
      getDatabase in class DBObject
      Returns:
      the database object
    • getDataType

      public DataType getDataType()
      Description copied from class: DBColumnExpr
      Returns the data type of this column expression.
      Specified by:
      getDataType in interface ColumnExpr
      Specified by:
      getDataType in class DBColumnExpr
      Returns:
      the expressions data type
      See Also:
    • getEnumType

      public Class<Enum<?>> getEnumType()
      Description copied from interface: ColumnExpr
      Returns the enum type for this column

      Returns:
      the enum type
    • getRowSet

      public DBRowSet getRowSet()
      Description copied from class: DBColumnExpr
      Returns the underlying rowset containing this column For functions involving none or more than one physical column this function return the first one
      Specified by:
      getRowSet in class DBColumnExpr
      Returns:
      a column used for this expression
    • getUpdateColumn

      public DBColumn getUpdateColumn()
      Description copied from class: DBColumnExpr
      Returns the underlying physical column. For functions involving none or more than one physical column this function returns null.
      Specified by:
      getUpdateColumn in interface ColumnExpr
      Specified by:
      getUpdateColumn in class DBColumnExpr
      Returns:
      the underlying column
    • isAggregate

      public boolean isAggregate()
      Description copied from class: DBColumnExpr
      Indicates whether this function is an aggregate (sum, min, max, avg, ...) or not
      Specified by:
      isAggregate in class DBColumnExpr
      Returns:
      true if the column expression represents an aggregate
    • addXml

      public Element addXml(Element parent, long flags)
      Description copied from class: DBColumnExpr
      Add a description of this column with relevant metadata to the supplied parent XML Element.
      Specified by:
      addXml in class DBColumnExpr
      Parameters:
      parent - the parent element to which to append the column description
      flags - currently not used
      Returns:
      the newly created child element
    • isNull

      protected boolean isNull(Object value)
      helper to check if an expression is null
      Parameters:
      value - the value to check
      Returns:
      true if null or false otherwise
    • isNotNull

      protected boolean isNotNull(Object value)
      helper to check if an expression is not null
      Parameters:
      value - the value
      Returns:
      true if not null or false otherwise
    • init

      protected void init(Map<?,?> valueMap, Object elseValue)
      Init case expression. Must be called from all constructors!
      Parameters:
      valueMap - the value or conditions map
      elseValue - the else value
    • getSourceColumnExpr

      protected DBColumnExpr getSourceColumnExpr(Collection<?> values, Object elseValue)
    • initDataTypeFromValue

      protected void initDataTypeFromValue(Object value)