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.STRINGstrategy (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 intgetDefaultSqlTypeCode()EnumJavaType<E>getDomainJavaType()Descriptor for the Java type for the domain portion of this converterintgetJdbcTypeCode()JavaType<String>getRelationalJavaType()Descriptor for the Java type for the relational portion of this converterEtoDomainValue(String relationalForm)Convert the relational form just retrieved from JDBC ResultSet into the domain form.StringtoRelationalValue(E domainForm)Convert the domain form into the relational form in preparation for storage into JDBCStringtoSqlLiteral(Object value)voidwriteValue(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:BasicValueConverterDescriptor for the Java type for the domain portion of this converter- Specified by:
getDomainJavaTypein interfaceBasicValueConverter<E extends Enum<E>,String>- Specified by:
getDomainJavaTypein interfaceEnumValueConverter<E extends Enum<E>,String>
-
getRelationalJavaType
public JavaType<String> getRelationalJavaType()
Description copied from interface:BasicValueConverterDescriptor for the Java type for the relational portion of this converter- Specified by:
getRelationalJavaTypein interfaceBasicValueConverter<E extends Enum<E>,String>
-
toDomainValue
public E toDomainValue(String relationalForm)
Description copied from interface:BasicValueConverterConvert the relational form just retrieved from JDBC ResultSet into the domain form.- Specified by:
toDomainValuein interfaceBasicValueConverter<E extends Enum<E>,String>
-
toRelationalValue
public String toRelationalValue(E domainForm)
Description copied from interface:BasicValueConverterConvert the domain form into the relational form in preparation for storage into JDBC- Specified by:
toRelationalValuein interfaceBasicValueConverter<E extends Enum<E>,String>
-
getJdbcTypeCode
public int getJdbcTypeCode()
- Specified by:
getJdbcTypeCodein interfaceEnumValueConverter<E extends Enum<E>,String>
-
getDefaultSqlTypeCode
public int getDefaultSqlTypeCode()
-
toSqlLiteral
public String toSqlLiteral(Object value)
- Specified by:
toSqlLiteralin interfaceEnumValueConverter<E extends Enum<E>,String>
-
writeValue
public void writeValue(PreparedStatement statement, E value, int position, SharedSessionContractImplementor session) throws SQLException
- Specified by:
writeValuein interfaceEnumValueConverter<E extends Enum<E>,String>- Throws:
SQLException
-
-