E
- the type of the enumpublic class EnumConverter<E extends Enum<E>> extends Object implements ValueConverter<E>
EntityClass
.Modifier and Type | Field and Description |
---|---|
private javax.persistence.EnumType |
exportType |
private Class<E> |
targetType |
Constructor and Description |
---|
EnumConverter(AttributeAccessor attribute,
Class<E> targetType,
boolean mapKey)
Creates a new instance of this
EnumConverter . |
Modifier and Type | Method and Description |
---|---|
ColumnExpression |
getExpression(E value,
GeneratorContext context)
Builds the expression for writing the given value into an SQL clause.
|
ColumnExpression |
getExpression(String defaultValue,
GeneratorContext context)
Builds the expression for writing the default value into an SQL clause.
|
public EnumConverter(AttributeAccessor attribute, Class<E> targetType, boolean mapKey)
EnumConverter
.attribute
- the inspected attributetargetType
- the type of the enummapKey
- indicates that the converter is for the key of a mappublic ColumnExpression getExpression(E value, GeneratorContext context)
ValueConverter
getExpression
in interface ValueConverter<E extends Enum<E>>
value
- the current valuecontext
- the current context (contains the database dialect).public ColumnExpression getExpression(String defaultValue, GeneratorContext context)
ValueConverter
getExpression
in interface ValueConverter<E extends Enum<E>>
defaultValue
- the default value, as given in an DefaultValue
expressioncontext
- the current context (contains the database dialect).Copyright © 2022 fastnate.org. All rights reserved.