Package org.fastnate.generator.converter
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
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 Summary
ConstructorsConstructorDescriptionAbstractDateConverter(jakarta.persistence.TemporalType type) AbstractDateConverter(AttributeAccessor attribute, boolean mapKey) Creates a new instance of thisAbstractDateConverter. -
Method Summary
Modifier and TypeMethodDescriptiongetExpression(String defaultValue, GeneratorContext context) Use database independent default values.getExpression(Date value, GeneratorContext context) Converts the given value into an SQL expression.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.fastnate.generator.converter.ValueConverter
getExpression
-
Constructor Details
-
AbstractDateConverter
Creates a new instance of thisAbstractDateConverter.- Parameters:
attribute- the inspected attributemapKey- indicates that the converter is used for the key of a map property
-
AbstractDateConverter
public AbstractDateConverter(jakarta.persistence.TemporalType type)
-
-
Method Details
-
getExpression
Converts the given value into an SQL expression.- Parameters:
value- the value to convertcontext- the current context- Returns:
- the SQL expression
-
getExpression
Use database independent default values.- Specified by:
getExpressionin interfaceValueConverter<T>- Parameters:
defaultValue- the default value, as given in anDefaultValueexpressioncontext- the current context (contains the database dialect).- Returns:
- the expression (that is including surrounding ' for string literals)
-