26 lines
727 B
Java
26 lines
727 B
Java
package gr.cite.notification.data.conventers;
|
|
|
|
|
|
|
|
import gr.cite.notification.common.enums.NotificationTemplateChannel;
|
|
|
|
import javax.persistence.Converter;
|
|
|
|
@Converter
|
|
public class NotificationTemplateChannelConverter extends DatabaseEnumConverter<NotificationTemplateChannel, Short> {
|
|
public NotificationTemplateChannel of(Short i) {
|
|
return NotificationTemplateChannel.of(i);
|
|
}
|
|
|
|
@Override
|
|
public Short convertToDatabaseColumn(NotificationTemplateChannel value) {
|
|
if (value == null) return null;
|
|
return value.getValue();
|
|
}
|
|
|
|
@Override
|
|
public NotificationTemplateChannel convertToEntityAttribute(Short dbData) {
|
|
return dbData == null ? null : this.of(dbData);
|
|
}
|
|
}
|