Class AbstractDateConverter<T>

java.lang.Object
org.fastnate.generator.converter.AbstractDateConverter<T>
Type Parameters:
T - the date type
All Implemented Interfaces:
ValueConverter<T>
Direct Known Subclasses:
CalendarConverter, DateConverter

public abstract class AbstractDateConverter<T> extends Object implements ValueConverter<T>
Base class for converting a Date, Calendar, Date, Time or Timestamp property of an EntityClass to a SQL expression.
Author:
Andreas Penski, Heiko Schefter
  • Constructor Details

    • AbstractDateConverter

      public AbstractDateConverter(AttributeAccessor attribute, boolean mapKey)
      Creates a new instance of this AbstractDateConverter.
      Parameters:
      attribute - the inspected attribute
      mapKey - indicates that the converter is used for the key of a map property
    • AbstractDateConverter

      public AbstractDateConverter(jakarta.persistence.TemporalType type)
  • Method Details

    • getExpression

      public ColumnExpression getExpression(Date value, GeneratorContext context)
      Converts the given value into an SQL expression.
      Parameters:
      value - the value to convert
      context - the current context
      Returns:
      the SQL expression
    • getExpression

      public ColumnExpression getExpression(String defaultValue, GeneratorContext context)
      Use database independent default values.
      Specified by:
      getExpression in interface ValueConverter<T>
      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)