| 1 | package fr.sii.ogham.core.convert; | |
| 2 | ||
| 3 | /** | |
| 4 | * A no-op converter that just casts the source to match the target type. | |
| 5 | * | |
| 6 | * Cast is only applied if the source object is an instance of target type. | |
| 7 | * | |
| 8 | * @author Aurélien Baudet | |
| 9 | * | |
| 10 | */ | |
| 11 | public class NoConversionNeededConverter implements SupportingConverter { | |
| 12 | ||
| 13 | @SuppressWarnings("unchecked") | |
| 14 | @Override | |
| 15 | public <T> T convert(Object source, Class<T> targetType) { | |
| 16 |
1
1. convert : replaced return value with null for fr/sii/ogham/core/convert/NoConversionNeededConverter::convert → RUN_ERROR |
return (T) source; |
| 17 | } | |
| 18 | ||
| 19 | @Override | |
| 20 | public boolean supports(Class<?> sourceType, Class<?> targetType) { | |
| 21 |
2
1. supports : replaced boolean return with false for fr/sii/ogham/core/convert/NoConversionNeededConverter::supports → RUN_ERROR 2. supports : replaced boolean return with true for fr/sii/ogham/core/convert/NoConversionNeededConverter::supports → RUN_ERROR |
return targetType.isAssignableFrom(sourceType); |
| 22 | } | |
| 23 | ||
| 24 | } | |
Mutations | ||
| 16 |
1.1 |
|
| 21 |
1.1 2.2 |