Class DBGeneratedValue

Direct Known Subclasses:
DBGeneratedValue.DBFuncGeneratedValue, DBGeneratedValue.DBTriggerGeneratedValue

public abstract class DBGeneratedValue extends DBExpr
DBGeneratedValue Abstract base class for Auto generated values
Author:
doebele
  • Field Details

    • log

      protected static final org.slf4j.Logger log
    • db

      protected final DBDatabase db
  • Constructor Details

    • DBGeneratedValue

      public DBGeneratedValue(DBDatabase db)
  • Method Details

    • byTrigger

      public static DBGeneratedValue byTrigger(DBTable table, String triggerName, DBTableColumn... columns)
      Returns a generated value for a trigger
      Parameters:
      table - the table on which the trigger
      triggerName - then name of the trigger
      columns - the list of columns used by the trigger
      Returns:
      the value generator
    • byFunction

      public static DBGeneratedValue byFunction(DBTable table, String functionTemplate)
      Returns generator for a record value created from other record fields The function template must contain the column names wrapped in square brackets like e.g. "normalize([name])" or "[lastName]+', '+[firstName]"
      Parameters:
      table - the table for which the value is generated
      Returns:
      the value generator
    • isModified

      public abstract boolean isModified(Record record)
      Returns true if the value was modified and thus needs to be be updated in the record
      Parameters:
      record - the record for which to check
      Returns:
      true if the value was modified and needs to be be updated
    • eval

      public abstract Object eval(Record record)
      Evaluates a record and returns the generated value
      Parameters:
      record - the record for which to evaluate
      Returns:
      the generated value
    • getDatabase

      public <T extends DBDatabase> T 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
      Type Parameters:
      T - the object type
      Returns:
      the current DBDatabase object