tech.simter.jpa.ext.PersistenceEnumConverter Maven / Gradle / Ivy
The newest version!
package tech.simter.jpa.ext;
import tech.simter.persistence.PersistenceEnum;
import javax.persistence.AttributeConverter;
/**
* Abstract class for convert entity attribute state into database column.
*
* @param the type of the entity attribute
* @param the type of the database column
* @author dragon 2017-04-28
*/
public abstract class PersistenceEnumConverter, V> implements AttributeConverter {
@Override
public V convertToDatabaseColumn(E attribute) {
return attribute == null ? null : attribute.value();
}
}