Class TemporalConverter<T extends Temporal>

java.lang.Object
org.fastnate.generator.converter.TemporalConverter<T>
Type Parameters:
T - the type of the temporal
All Implemented Interfaces:
ValueConverter<T>

public class TemporalConverter<T extends Temporal> extends Object implements ValueConverter<T>
Converts the Temporal types from java.time to SQL expressions.
Author:
Tobias Liefke
  • Constructor Details

    • TemporalConverter

      public TemporalConverter(Class<?> type)
      Creates a new converter.
      Parameters:
      type - the type of the attribute
  • Method Details

    • 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<T extends Temporal>
      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)
    • getExpression

      public ColumnExpression getExpression(T 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<T extends Temporal>
      Parameters:
      value - the current value
      context - the current context (contains the database dialect).
      Returns:
      the expression (that is including surrounding ' for string literals)