Class SequenceValueExpression

java.lang.Object
org.fastnate.generator.statements.SequenceValueExpression
All Implemented Interfaces:
ColumnExpression
Direct Known Subclasses:
CurrentSequenceValueExpression, NextSequenceValueExpression

public abstract class SequenceValueExpression extends Object implements ColumnExpression
Base class for ColumnExpressions which reference an ID by using the value of a sequence.
Author:
Tobias Liefke
  • Constructor Details

    • SequenceValueExpression

      public SequenceValueExpression(SequenceIdGenerator sequence, long difference)
      Creates a new SequenceValueExpression instance.
      Parameters:
      sequence - The written sequence.
      difference - The difference of the referenced ID to the sequence value.
  • Method Details

    • toSql

      protected String toSql(String sql)
      Builds the SQL expression by using the given SQL and the current difference.
      Parameters:
      sql - the SQL expression that references the sequence
      Returns:
      the SQL expression that references the sequence and respects the difference
    • getSequence

      public SequenceIdGenerator getSequence()
      The written sequence.
    • getDifference

      public long getDifference()
      The difference of the referenced ID to the sequence value.