| 1 | package fr.sii.ogham.core.util.converter; | |
| 2 | ||
| 3 | import org.apache.commons.beanutils.converters.AbstractConverter; | |
| 4 | import org.slf4j.Logger; | |
| 5 | import org.slf4j.LoggerFactory; | |
| 6 | ||
| 7 | import fr.sii.ogham.email.message.EmailAddress; | |
| 8 | ||
| 9 | /** | |
| 10 | * Converts the provided object into an {@link EmailAddress}. This converter is | |
| 11 | * used by Apache Commons BeanUtils library. | |
| 12 | * | |
| 13 | * @author Aurélien Baudet | |
| 14 | * | |
| 15 | */ | |
| 16 | public class EmailAddressConverter extends AbstractConverter { | |
| 17 | private static final Logger LOG = LoggerFactory.getLogger(EmailAddressConverter.class); | |
| 18 | ||
| 19 | @Override | |
| 20 | protected <T> T convertToType(Class<T> type, Object value) throws Throwable { | |
| 21 | LOG.debug("Converting string email address {} into EmailAddress", value); | |
| 22 |
4
1. convertToType : negated conditional → NO_COVERAGE 2. convertToType : negated conditional → NO_COVERAGE 3. convertToType : negated conditional → KILLED 4. convertToType : negated conditional → KILLED |
if (value instanceof String && EmailAddress.class.isAssignableFrom(type)) { |
| 23 |
2
1. convertToType : replaced return value with null for fr/sii/ogham/core/util/converter/EmailAddressConverter::convertToType → NO_COVERAGE 2. convertToType : replaced return value with null for fr/sii/ogham/core/util/converter/EmailAddressConverter::convertToType → KILLED |
return type.cast(new EmailAddress((String) value)); |
| 24 | } | |
| 25 | throw conversionException(type, value); | |
| 26 | } | |
| 27 | ||
| 28 | @Override | |
| 29 | protected Class<?> getDefaultType() { | |
| 30 |
1
1. getDefaultType : replaced return value with null for fr/sii/ogham/core/util/converter/EmailAddressConverter::getDefaultType → NO_COVERAGE |
return EmailAddress.class; |
| 31 | } | |
| 32 | ||
| 33 | } | |
Mutations | ||
| 22 |
1.1 2.2 3.3 4.4 |
|
| 23 |
1.1 2.2 |
|
| 30 |
1.1 |