Class NamedEnumValueConverter<E extends Enum<E>>
- java.lang.Object
-
- org.hibernate.metamodel.model.convert.internal.NamedEnumValueConverter<E>
-
- All Implemented Interfaces:
Serializable
,BasicValueConverter<E,String>
,EnumValueConverter<E,String>
public class NamedEnumValueConverter<E extends Enum<E>> extends Object implements EnumValueConverter<E,String>, Serializable
BasicValueConverter handling the conversion of an enum based on JPAEnumType.STRING
strategy (storing the name)- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NamedEnumValueConverter(EnumJavaType<E> domainTypeDescriptor, JdbcType jdbcType, JavaType<String> relationalTypeDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDefaultSqlTypeCode()
EnumJavaType<E>
getDomainJavaType()
Descriptor for the Java type for the domain portion of this converterint
getJdbcTypeCode()
JavaType<String>
getRelationalJavaType()
Descriptor for the Java type for the relational portion of this converterE
toDomainValue(String relationalForm)
Convert the relational form just retrieved from JDBC ResultSet into the domain form.String
toRelationalValue(E domainForm)
Convert the domain form into the relational form in preparation for storage into JDBCString
toSqlLiteral(Object value)
void
writeValue(PreparedStatement statement, E value, int position, SharedSessionContractImplementor session)
-
-
-
Constructor Detail
-
NamedEnumValueConverter
public NamedEnumValueConverter(EnumJavaType<E> domainTypeDescriptor, JdbcType jdbcType, JavaType<String> relationalTypeDescriptor)
-
-
Method Detail
-
getDomainJavaType
public EnumJavaType<E> getDomainJavaType()
Description copied from interface:BasicValueConverter
Descriptor for the Java type for the domain portion of this converter- Specified by:
getDomainJavaType
in interfaceBasicValueConverter<E extends Enum<E>,String>
- Specified by:
getDomainJavaType
in interfaceEnumValueConverter<E extends Enum<E>,String>
-
getRelationalJavaType
public JavaType<String> getRelationalJavaType()
Description copied from interface:BasicValueConverter
Descriptor for the Java type for the relational portion of this converter- Specified by:
getRelationalJavaType
in interfaceBasicValueConverter<E extends Enum<E>,String>
-
toDomainValue
public E toDomainValue(String relationalForm)
Description copied from interface:BasicValueConverter
Convert the relational form just retrieved from JDBC ResultSet into the domain form.- Specified by:
toDomainValue
in interfaceBasicValueConverter<E extends Enum<E>,String>
-
toRelationalValue
public String toRelationalValue(E domainForm)
Description copied from interface:BasicValueConverter
Convert the domain form into the relational form in preparation for storage into JDBC- Specified by:
toRelationalValue
in interfaceBasicValueConverter<E extends Enum<E>,String>
-
getJdbcTypeCode
public int getJdbcTypeCode()
- Specified by:
getJdbcTypeCode
in interfaceEnumValueConverter<E extends Enum<E>,String>
-
getDefaultSqlTypeCode
public int getDefaultSqlTypeCode()
-
toSqlLiteral
public String toSqlLiteral(Object value)
- Specified by:
toSqlLiteral
in interfaceEnumValueConverter<E extends Enum<E>,String>
-
writeValue
public void writeValue(PreparedStatement statement, E value, int position, SharedSessionContractImplementor session) throws SQLException
- Specified by:
writeValue
in interfaceEnumValueConverter<E extends Enum<E>,String>
- Throws:
SQLException
-
-