| 1 | package fr.sii.ogham.template.thymeleaf.v2.adapter; | |
| 2 | ||
| 3 | import java.util.function.Consumer; | |
| 4 | ||
| 5 | import org.thymeleaf.templateresolver.ITemplateResolver; | |
| 6 | import org.thymeleaf.templateresolver.TemplateResolver; | |
| 7 | ||
| 8 | import fr.sii.ogham.template.thymeleaf.common.TemplateResolverOptions; | |
| 9 | import fr.sii.ogham.template.thymeleaf.common.adapter.TemplateResolverOptionsApplier; | |
| 10 | ||
| 11 | /** | |
| 12 | * Apply options on {@link TemplateResolver} instance (configurable). | |
| 13 | * | |
| 14 | * @author Aurélien Baudet | |
| 15 | * | |
| 16 | */ | |
| 17 | public class ThymeleafV2TemplateOptionsApplier implements TemplateResolverOptionsApplier { | |
| 18 | ||
| 19 | @Override | |
| 20 | public void apply(ITemplateResolver templateResolver, TemplateResolverOptions options) { | |
| 21 |
3
1. apply : negated conditional → NO_COVERAGE 2. apply : negated conditional → TIMED_OUT 3. apply : negated conditional → KILLED |
if (templateResolver instanceof TemplateResolver) { |
| 22 | // TODO: handle other options ? | |
| 23 | TemplateResolver resolver = (TemplateResolver) templateResolver; | |
| 24 |
3
1. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → SURVIVED 2. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → NO_COVERAGE 3. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → TIMED_OUT |
set(resolver::setTemplateMode, options.getTemplateMode()); |
| 25 |
3
1. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → NO_COVERAGE 2. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → TIMED_OUT 3. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → KILLED |
set(resolver::setCacheable, options.getCacheable()); |
| 26 | } | |
| 27 | } | |
| 28 | ||
| 29 | private <T> void set(Consumer<T> setter, T value) { | |
| 30 |
3
1. set : negated conditional → NO_COVERAGE 2. set : negated conditional → TIMED_OUT 3. set : negated conditional → KILLED |
if (value != null) { |
| 31 |
3
1. set : removed call to java/util/function/Consumer::accept → NO_COVERAGE 2. set : removed call to java/util/function/Consumer::accept → TIMED_OUT 3. set : removed call to java/util/function/Consumer::accept → KILLED |
setter.accept(value); |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | } | |
Mutations | ||
| 21 |
1.1 2.2 3.3 |
|
| 24 |
1.1 2.2 3.3 |
|
| 25 |
1.1 2.2 3.3 |
|
| 30 |
1.1 2.2 3.3 |
|
| 31 |
1.1 2.2 3.3 |