Package org.fastnate.generator.converter
Class EnumConverter<E extends Enum<E>>
java.lang.Object
org.fastnate.generator.converter.EnumConverter<E>
- Type Parameters:
E- the type of the enum
- All Implemented Interfaces:
ValueConverter<E>
Describes a enum property of an
EntityClass.- Author:
- Tobias Liefke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final jakarta.persistence.EnumType -
Constructor Summary
ConstructorsConstructorDescriptionEnumConverter(AttributeAccessor attribute, Class<E> targetType, boolean mapKey) Creates a new instance of thisEnumConverter. -
Method Summary
Modifier and TypeMethodDescriptiongetExpression(E value, GeneratorContext context) Builds the expression for writing the given value into an SQL clause.getExpression(String defaultValue, GeneratorContext context) Builds the expression for writing the default value into an SQL clause.
-
Field Details
-
targetType
-
exportType
private final jakarta.persistence.EnumType exportType
-
-
Constructor Details
-
EnumConverter
Creates a new instance of thisEnumConverter.- Parameters:
attribute- the inspected attributetargetType- the type of the enummapKey- indicates that the converter is for the key of a map
-
-
Method Details
-
getExpression
Description copied from interface:ValueConverterBuilds the expression for writing the given value into an SQL clause.- Specified by:
getExpressionin interfaceValueConverter<E extends Enum<E>>- Parameters:
value- the current valuecontext- the current context (contains the database dialect).- Returns:
- the expression (that is including surrounding ' for string literals)
-
getExpression
Description copied from interface:ValueConverterBuilds the expression for writing the default value into an SQL clause.- Specified by:
getExpressionin interfaceValueConverter<E extends Enum<E>>- 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)
-