| 1 | package fr.sii.ogham.template.thymeleaf.common; | |
| 2 | ||
| 3 | import fr.sii.ogham.core.exception.template.ContextException; | |
| 4 | import fr.sii.ogham.core.template.context.Context; | |
| 5 | import fr.sii.ogham.core.template.context.LocaleContext; | |
| 6 | ||
| 7 | /** | |
| 8 | * Simple converter that is able to handle {@link Context} and | |
| 9 | * {@link LocaleContext}. | |
| 10 | * | |
| 11 | * @author Aurélien Baudet | |
| 12 | * | |
| 13 | */ | |
| 14 | public class SimpleThymeleafContextConverter implements ThymeleafContextConverter { | |
| 15 | @Override | |
| 16 | public org.thymeleaf.context.IContext convert(Context context) throws ContextException { | |
| 17 | org.thymeleaf.context.Context thymeleafContext = new org.thymeleaf.context.Context(); | |
| 18 | | |
| 19 |
1
1. convert : removed call to org/thymeleaf/context/Context::setVariables → RUN_ERROR |
thymeleafContext.setVariables(context.getVariables()); |
| 20 |
1
1. convert : negated conditional → RUN_ERROR |
if (context instanceof LocaleContext) { |
| 21 |
1
1. convert : removed call to org/thymeleaf/context/Context::setLocale → RUN_ERROR |
thymeleafContext.setLocale(((LocaleContext) context).getLocale()); |
| 22 | } | |
| 23 | | |
| 24 |
1
1. convert : replaced return value with null for fr/sii/ogham/template/thymeleaf/common/SimpleThymeleafContextConverter::convert → RUN_ERROR |
return thymeleafContext; |
| 25 | } | |
| 26 | } | |
Mutations | ||
| 19 |
1.1 |
|
| 20 |
1.1 |
|
| 21 |
1.1 |
|
| 24 |
1.1 |