Class DurationConverter

java.lang.Object
org.fastnate.generator.converter.DurationConverter
All Implemented Interfaces:
ValueConverter<Duration>

public class DurationConverter extends Object implements ValueConverter<Duration>
Converts a Duration to an SQL expression.
Author:
Tobias Liefke
  • Constructor Details

    • DurationConverter

      public DurationConverter()
  • Method Details

    • getExpression

      public ColumnExpression getExpression(Duration value, GeneratorContext context)
      Description copied from interface: ValueConverter
      Builds the expression for writing the given value into an SQL clause.
      Specified by:
      getExpression in interface ValueConverter<Duration>
      Parameters:
      value - the current value
      context - the current context (contains the database dialect).
      Returns:
      the expression (that is including surrounding ' for string literals)
    • getExpression

      public ColumnExpression getExpression(String defaultValue, GeneratorContext context)
      Description copied from interface: ValueConverter
      Builds the expression for writing the default value into an SQL clause.
      Specified by:
      getExpression in interface ValueConverter<Duration>
      Parameters:
      defaultValue - the default value, as given in an DefaultValue expression
      context - the current context (contains the database dialect).
      Returns:
      the expression (that is including surrounding ' for string literals)