1 | package fr.sii.ogham.core.builder.resolution; | |
2 | ||
3 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilder; | |
4 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderDelegate; | |
5 | import fr.sii.ogham.core.builder.context.BuildContext; | |
6 | import fr.sii.ogham.core.builder.env.EnvironmentBuilder; | |
7 | import fr.sii.ogham.core.resource.resolver.FileResolver; | |
8 | import fr.sii.ogham.core.resource.resolver.ResourceResolver; | |
9 | ||
10 | /** | |
11 | * Configure resource resolver that loads files from filesystem. | |
12 | * | |
13 | * <p> | |
14 | * You can define the lookup (the prefix that indicates that filesystem | |
15 | * resolution must be used). For example: | |
16 | * | |
17 | * <pre> | |
18 | * .file().lookup("file:"); | |
19 | * | |
20 | * // path prefixed by file: matches | |
21 | * // then file resolver is used | |
22 | * resourceResolver.getResource("file:foo/bar.html"); | |
23 | * // path is not prefixed (or using another prefix) doesn't match | |
24 | * // then file resolver is not used | |
25 | * resourceResolver.getResource("foo/bar.html"); | |
26 | * </pre> | |
27 | * | |
28 | * <p> | |
29 | * You can define a path prefix and suffix for finding resources: | |
30 | * | |
31 | * <pre> | |
32 | * .file().lookup("file:").pathPrefix("foo/").pathSuffix(".html"); | |
33 | * | |
34 | * resourceResolver.getResource("bar"); | |
35 | * </pre> | |
36 | * | |
37 | * This will use the file resolver and the real path is {@code foo/bar.html}. | |
38 | * | |
39 | * @author Aurélien Baudet | |
40 | * | |
41 | * @param <P> | |
42 | * the type of the parent builder (when calling {@link #and()} | |
43 | * method) | |
44 | */ | |
45 | public class FileResolutionBuilder<P> extends AbstractSingleResolutionBuilder<FileResolutionBuilder<P>, P> implements PrefixSuffixBuilder<FileResolutionBuilder<P>> { | |
46 | ||
47 | /** | |
48 | * Initializes with the parent builder and the {@link EnvironmentBuilder}. | |
49 | * The parent builder is used when calling the {@link #and()} method. The | |
50 | * {@link EnvironmentBuilder} is used when calling {@link #build()} method | |
51 | * in order to evaluate property value. | |
52 | * | |
53 | * @param parent | |
54 | * the parent builder | |
55 | * @param buildContext | |
56 | * for property resolution | |
57 | */ | |
58 | public FileResolutionBuilder(P parent, BuildContext buildContext) { | |
59 | super(FileResolutionBuilder.class, parent, buildContext); | |
60 | } | |
61 | ||
62 | @Override | |
63 | protected ResourceResolver createResolver() { | |
64 |
8
1. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → NO_COVERAGE 2. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → SURVIVED 3. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED 4. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED 5. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED 6. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED 7. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED 8. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED |
return new FileResolver(lookups); |
65 | } | |
66 | ||
67 | @Override | |
68 | public FileResolutionBuilder<P> pathPrefix(String prefix) { | |
69 |
4
1. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → SURVIVED 2. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 3. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED 4. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED |
pathPrefixValueBuilder.setValue(prefix); |
70 |
4
1. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE 2. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED 3. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED 4. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED |
return myself; |
71 | } | |
72 | ||
73 | @Override | |
74 | public ConfigurationValueBuilder<FileResolutionBuilder<P>, String> pathPrefix() { | |
75 |
4
1. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE 2. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED 3. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED 4. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED |
return new ConfigurationValueBuilderDelegate<>(myself, pathPrefixValueBuilder); |
76 | } | |
77 | ||
78 | @Override | |
79 | public FileResolutionBuilder<P> pathSuffix(String suffix) { | |
80 |
1
1. pathSuffix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE |
pathSuffixValueBuilder.setValue(suffix); |
81 |
1
1. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE |
return myself; |
82 | } | |
83 | ||
84 | @Override | |
85 | public ConfigurationValueBuilder<FileResolutionBuilder<P>, String> pathSuffix() { | |
86 |
4
1. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE 2. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED 3. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED 4. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED |
return new ConfigurationValueBuilderDelegate<>(myself, pathSuffixValueBuilder); |
87 | } | |
88 | } | |
Mutations | ||
64 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 |
|
69 |
1.1 2.2 3.3 4.4 |
|
70 |
1.1 2.2 3.3 4.4 |
|
75 |
1.1 2.2 3.3 4.4 |
|
80 |
1.1 |
|
81 |
1.1 |
|
86 |
1.1 2.2 3.3 4.4 |