1 package org.imageconverter.util.jpaconverters;
2
3 import static org.apache.commons.lang3.StringUtils.upperCase;
4
5 import javax.persistence.AttributeConverter;
6 import javax.persistence.Converter;
7
8 import org.imageconverter.domain.conversion.ExecutionType;
9
10
11
12
13
14
15 @Converter(autoApply = true)
16 public class ExcutionTypeConverter implements AttributeConverter<ExecutionType, String> {
17
18
19
20
21 @Override
22 public String convertToDatabaseColumn(final ExecutionType attribute) {
23 return upperCase(attribute.toString());
24 }
25
26
27
28
29 @Override
30 public ExecutionType convertToEntityAttribute(final String dbData) {
31 return ExecutionType.from(dbData);
32 }
33 }