| 1 | package fr.sii.ogham.core.builder.resolution; | |
| 2 | ||
| 3 | import fr.sii.ogham.core.builder.MessagingBuilder; | |
| 4 | import fr.sii.ogham.core.builder.context.BuildContext; | |
| 5 | import fr.sii.ogham.core.builder.env.EnvironmentBuilder; | |
| 6 | import fr.sii.ogham.core.fluent.AbstractParent; | |
| 7 | import fr.sii.ogham.core.resource.resolver.ResourceResolver; | |
| 8 | ||
| 9 | /** | |
| 10 | * Builder that configures resource resolution. | |
| 11 | * | |
| 12 | * <p> | |
| 13 | * Resource resolution consists of finding a file: | |
| 14 | * <ul> | |
| 15 | * <li>either on filesystem</li> | |
| 16 | * <li>or in the classpath</li> | |
| 17 | * <li>or anywhere else</li> | |
| 18 | * </ul> | |
| 19 | * | |
| 20 | * This implementation is used by {@link MessagingBuilder} for general | |
| 21 | * configuration. That configuration may be inherited (applied to other resource | |
| 22 | * resolution builders). | |
| 23 | * | |
| 24 | * This implementation simply delegates to the | |
| 25 | * {@link ResourceResolutionBuilderHelper}. | |
| 26 | * | |
| 27 | * @author Aurélien Baudet | |
| 28 | * | |
| 29 | * @param <P> | |
| 30 | * the type of the parent builder (when calling {@link #and()} | |
| 31 | * method) | |
| 32 | */ | |
| 33 | public class StandaloneResourceResolutionBuilder<P> extends AbstractParent<P> implements ResourceResolutionBuilder<StandaloneResourceResolutionBuilder<P>> { | |
| 34 | private ResourceResolutionBuilderHelper<StandaloneResourceResolutionBuilder<P>> helper; | |
| 35 | ||
| 36 | /** | |
| 37 | * The builder is used alone (not in a context of a parent). In this case, | |
| 38 | * parent is set to {@code null} meaning that {@link #and()} will return | |
| 39 | * {@code null}. | |
| 40 | * | |
| 41 | * @param buildContext | |
| 42 | * for registering instances and property evaluation | |
| 43 | */ | |
| 44 | public StandaloneResourceResolutionBuilder(BuildContext buildContext) { | |
| 45 | this(null, buildContext); | |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * The builder is used by a parent builder. The parent is used when calling | |
| 50 | * {@link #and()} method for chaining calls. The {@link EnvironmentBuilder} | |
| 51 | * is used to evaluate properties at build time. | |
| 52 | * | |
| 53 | * @param parent | |
| 54 | * the parent builder | |
| 55 | * @param buildContext | |
| 56 | * for registering instances and property evaluation | |
| 57 | */ | |
| 58 | public StandaloneResourceResolutionBuilder(P parent, BuildContext buildContext) { | |
| 59 | super(parent); | |
| 60 | helper = new ResourceResolutionBuilderHelper<>(this, buildContext); | |
| 61 | } | |
| 62 | ||
| 63 | @Override | |
| 64 | public ClassPathResolutionBuilder<StandaloneResourceResolutionBuilder<P>> classpath() { | |
| 65 |
1
1. classpath : replaced return value with null for fr/sii/ogham/core/builder/resolution/StandaloneResourceResolutionBuilder::classpath → RUN_ERROR |
return helper.classpath(); |
| 66 | } | |
| 67 | ||
| 68 | @Override | |
| 69 | public FileResolutionBuilder<StandaloneResourceResolutionBuilder<P>> file() { | |
| 70 |
1
1. file : replaced return value with null for fr/sii/ogham/core/builder/resolution/StandaloneResourceResolutionBuilder::file → RUN_ERROR |
return helper.file(); |
| 71 | } | |
| 72 | ||
| 73 | @Override | |
| 74 | public StringResolutionBuilder<StandaloneResourceResolutionBuilder<P>> string() { | |
| 75 |
1
1. string : replaced return value with null for fr/sii/ogham/core/builder/resolution/StandaloneResourceResolutionBuilder::string → RUN_ERROR |
return helper.string(); |
| 76 | } | |
| 77 | ||
| 78 | @Override | |
| 79 | public StandaloneResourceResolutionBuilder<P> resolver(ResourceResolver resolver) { | |
| 80 |
1
1. resolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/StandaloneResourceResolutionBuilder::resolver → NO_COVERAGE |
return helper.resolver(resolver); |
| 81 | } | |
| 82 | ||
| 83 | } | |
Mutations | ||
| 65 |
1.1 |
|
| 70 |
1.1 |
|
| 75 |
1.1 |
|
| 80 |
1.1 |