| 1 | package fr.sii.ogham.core.template.detector; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | import java.util.Arrays; | |
| 5 | import java.util.List; | |
| 6 | ||
| 7 | /** | |
| 8 | * A decorator for template engine detection that relies on other template | |
| 9 | * engine detectors. It implements the template design pattern to simplify | |
| 10 | * algorithms with interaction of multiple detectors. | |
| 11 | * | |
| 12 | * @author Aurélien Baudet | |
| 13 | * | |
| 14 | */ | |
| 15 | public abstract class CompositeTemplateDetector implements TemplateEngineDetector { | |
| 16 | ||
| 17 | /** | |
| 18 | * The list of real detectors | |
| 19 | */ | |
| 20 | private List<TemplateEngineDetector> detectors; | |
| 21 | ||
| 22 | /** | |
| 23 | * Initialize the composite detector with none, one or several detector | |
| 24 | * implementations. | |
| 25 | * | |
| 26 | * @param detectors | |
| 27 | * the real template engine detector implementations | |
| 28 | */ | |
| 29 | public CompositeTemplateDetector(TemplateEngineDetector... detectors) { | |
| 30 | this(new ArrayList<>(Arrays.asList(detectors))); | |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * Initialize the composite detector with the provided detector | |
| 35 | * implementation list. | |
| 36 | * | |
| 37 | * @param detectors | |
| 38 | * the real template engine detector implementations | |
| 39 | */ | |
| 40 | public CompositeTemplateDetector(List<TemplateEngineDetector> detectors) { | |
| 41 | super(); | |
| 42 | this.detectors = detectors; | |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * Register a new template engine detector. The detector is added at the end | |
| 47 | * and will be used only if none of the previous detectors could handle the | |
| 48 | * template. | |
| 49 | * | |
| 50 | * @param detector | |
| 51 | * the template engine detector to register | |
| 52 | */ | |
| 53 | public void addDetector(TemplateEngineDetector detector) { | |
| 54 | detectors.add(detector); | |
| 55 | } | |
| 56 | ||
| 57 | public List<TemplateEngineDetector> getDetectors() { | |
| 58 |
4
1. getDetectors : replaced return value with Collections.emptyList for fr/sii/ogham/core/template/detector/CompositeTemplateDetector::getDetectors → NO_COVERAGE 2. getDetectors : replaced return value with Collections.emptyList for fr/sii/ogham/core/template/detector/CompositeTemplateDetector::getDetectors → TIMED_OUT 3. getDetectors : replaced return value with Collections.emptyList for fr/sii/ogham/core/template/detector/CompositeTemplateDetector::getDetectors → KILLED 4. getDetectors : replaced return value with Collections.emptyList for fr/sii/ogham/core/template/detector/CompositeTemplateDetector::getDetectors → KILLED |
return detectors; |
| 59 | } | |
| 60 | } | |
Mutations | ||
| 58 |
1.1 2.2 3.3 4.4 |