1 | package fr.sii.ogham.core.template.detector; | |
2 | ||
3 | import fr.sii.ogham.core.exception.template.EngineDetectionException; | |
4 | import fr.sii.ogham.core.resource.Resource; | |
5 | import fr.sii.ogham.core.resource.path.ResourcePath; | |
6 | import fr.sii.ogham.core.template.context.Context; | |
7 | ||
8 | /** | |
9 | * Most basic detector that always provide the same detection value. None of the | |
10 | * information (template name, context or template content) is used. The value | |
11 | * is set at construction and never changes. | |
12 | * | |
13 | * @author Aurélien Baudet | |
14 | * | |
15 | */ | |
16 | public class FixedEngineDetector implements TemplateEngineDetector { | |
17 | ||
18 | /** | |
19 | * The value to return every time | |
20 | * {@link #canParse(String, Context, Resource)} is called | |
21 | */ | |
22 | private boolean canParse; | |
23 | ||
24 | /** | |
25 | * Initialize the detector to always say yes to any template. The associated | |
26 | * template engine will always handle all the templates. | |
27 | */ | |
28 | public FixedEngineDetector() { | |
29 | this(true); | |
30 | } | |
31 | ||
32 | /** | |
33 | * Initialize the detector to always say yes or no to any template. If | |
34 | * canParse is true, then the associated template engine will always be | |
35 | * used. If canParse is false, then the associated template engine will | |
36 | * never be used. | |
37 | * | |
38 | * @param canParse | |
39 | * true to enable the associated template engine, false to | |
40 | * disable it | |
41 | */ | |
42 | public FixedEngineDetector(boolean canParse) { | |
43 | super(); | |
44 | this.canParse = canParse; | |
45 | } | |
46 | ||
47 | @Override | |
48 | public boolean canParse(ResourcePath template, Context ctx) throws EngineDetectionException { | |
49 |
5
1. canParse : replaced boolean return with false for fr/sii/ogham/core/template/detector/FixedEngineDetector::canParse → NO_COVERAGE 2. canParse : replaced boolean return with true for fr/sii/ogham/core/template/detector/FixedEngineDetector::canParse → SURVIVED 3. canParse : replaced boolean return with true for fr/sii/ogham/core/template/detector/FixedEngineDetector::canParse → NO_COVERAGE 4. canParse : replaced boolean return with false for fr/sii/ogham/core/template/detector/FixedEngineDetector::canParse → KILLED 5. canParse : replaced boolean return with false for fr/sii/ogham/core/template/detector/FixedEngineDetector::canParse → KILLED |
return canParse; |
50 | } | |
51 | ||
52 | } | |
Mutations | ||
49 |
1.1 2.2 3.3 4.4 5.5 |