1 | package fr.sii.ogham.core.builder.context; | |
2 | ||
3 | import java.util.List; | |
4 | import java.util.Properties; | |
5 | import java.util.function.Function; | |
6 | ||
7 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilder; | |
8 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderHelper; | |
9 | import fr.sii.ogham.core.convert.Converter; | |
10 | import fr.sii.ogham.core.convert.DefaultConverter; | |
11 | import fr.sii.ogham.core.env.JavaPropertiesResolver; | |
12 | import fr.sii.ogham.core.env.PropertyResolver; | |
13 | import fr.sii.ogham.core.util.BuilderUtils; | |
14 | ||
15 | /** | |
16 | * Simple build context that uses a default {@link PropertyResolver} and a | |
17 | * default {@link Converter}. | |
18 | * | |
19 | * <p> | |
20 | * <strong>WARNING: don't use it, this is for for advanced usage only | |
21 | * !!!</strong> | |
22 | * | |
23 | * | |
24 | * @author Aurélien Baudet | |
25 | * | |
26 | */ | |
27 | public class DefaultBuildContext implements BuildContext { | |
28 | private final PropertyResolver propertyResolver; | |
29 | private final Converter converter; | |
30 | ||
31 | public DefaultBuildContext() { | |
32 | this(new Properties()); | |
33 | } | |
34 | ||
35 | public DefaultBuildContext(Properties props) { | |
36 | super(); | |
37 | this.converter = new DefaultConverter(); | |
38 | this.propertyResolver = new JavaPropertiesResolver(props, converter); | |
39 | } | |
40 | ||
41 | @Override | |
42 | public <T> T register(T instance) { | |
43 |
9
1. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → NO_COVERAGE 2. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 3. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 4. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 5. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 6. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 7. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 8. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED 9. register : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::register → KILLED |
return instance; |
44 | } | |
45 | ||
46 | @Override | |
47 | public <T> T evaluate(List<String> properties, Class<T> resultClass) { | |
48 |
3
1. evaluate : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::evaluate → NO_COVERAGE 2. evaluate : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::evaluate → SURVIVED 3. evaluate : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::evaluate → TIMED_OUT |
return BuilderUtils.evaluate(properties, getPropertyResolver(), resultClass); |
49 | } | |
50 | ||
51 | @Override | |
52 | public PropertyResolver getPropertyResolver() { | |
53 |
4
1. getPropertyResolver : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getPropertyResolver → SURVIVED 2. getPropertyResolver : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getPropertyResolver → NO_COVERAGE 3. getPropertyResolver : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getPropertyResolver → TIMED_OUT 4. getPropertyResolver : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getPropertyResolver → KILLED |
return propertyResolver; |
54 | } | |
55 | ||
56 | @Override | |
57 | public Converter getConverter() { | |
58 |
2
1. getConverter : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getConverter → NO_COVERAGE 2. getConverter : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::getConverter → KILLED |
return converter; |
59 | } | |
60 | ||
61 | @Override | |
62 | @SuppressWarnings("unchecked") | |
63 | public <P, V, T extends ConfigurationValueBuilder<P, V>> T newConfigurationValueBuilder(P parent, Class<V> valueClass) { | |
64 |
18
1. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → NO_COVERAGE 2. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → NO_COVERAGE 3. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 4. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 5. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 6. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 7. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 8. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 9. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 10. lambda$newConfigurationValueBuilder$0 : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::lambda$newConfigurationValueBuilder$0 → KILLED 11. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 12. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 13. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 14. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 15. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 16. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 17. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 18. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED |
return newConfigurationValueBuilder(ctx -> (T) new ConfigurationValueBuilderHelper<>(parent, valueClass, ctx)); |
65 | } | |
66 | ||
67 | @Override | |
68 | public <P, V, T extends ConfigurationValueBuilder<P, V>> T newConfigurationValueBuilder(Function<BuildContext, T> factory) { | |
69 |
9
1. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → NO_COVERAGE 2. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 3. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 4. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 5. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 6. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 7. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 8. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED 9. newConfigurationValueBuilder : replaced return value with null for fr/sii/ogham/core/builder/context/DefaultBuildContext::newConfigurationValueBuilder → KILLED |
return factory.apply(this); |
70 | } | |
71 | ||
72 | } | |
Mutations | ||
43 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 |
|
48 |
1.1 2.2 3.3 |
|
53 |
1.1 2.2 3.3 4.4 |
|
58 |
1.1 2.2 |
|
64 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 15.15 16.16 17.17 18.18 |
|
69 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 |