• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AuthMe / ConfigMe / 6013592978

29 Aug 2023 02:22PM UTC coverage: 95.279%. First build
6013592978

push

github

ljacqu
New property builder: current working changes

526 of 544 branches covered (0.0%)

33 of 33 new or added lines in 5 files covered. (100.0%)

1453 of 1525 relevant lines covered (95.28%)

4.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/ch/jalu/configme/properties/builder/MapPropertyBuilder.java
1
package ch.jalu.configme.properties.builder;
2

3
import ch.jalu.configme.properties.MapProperty;
4
import ch.jalu.configme.properties.Property;
5
import ch.jalu.configme.properties.types.PropertyType;
6
import org.jetbrains.annotations.NotNull;
7

8
import java.util.LinkedHashMap;
9
import java.util.Map;
10
import java.util.function.BiFunction;
11

12
public class MapPropertyBuilder<V, M extends Map<String, V>, P extends Property<M>> {
13

14
    private String path;
15
    private final M defaultValue;
16
    private final BiFunction<String, M, P> createPropertyFunction;
17

18
    public MapPropertyBuilder(@NotNull BiFunction<String, M, P> createPropertyFunction, @NotNull M defaultValue) {
×
19
        this.createPropertyFunction = createPropertyFunction;
×
20
        this.defaultValue = defaultValue;
×
21
    }
×
22

23
    public static <V> @NotNull MapPropertyBuilder<V, Map<String, V>, MapProperty<V>> mapBuilder(
24
                                                                                   @NotNull PropertyType<V> entryType) {
25
        return new MapPropertyBuilder<>(
×
26
            (path, defVal) -> new MapProperty<>(path, defVal, entryType),
×
27
            new LinkedHashMap<>());
28
    }
29

30
    public @NotNull MapPropertyBuilder<V, M, P> path(@NotNull String path) {
31
        this.path = path;
×
32
        return this;
×
33
    }
34

35
    public @NotNull MapPropertyBuilder<V, M, P> addToDefaultValue(@NotNull String key, @NotNull V value) {
36
        defaultValue.put(key, value);
×
37
        return this;
×
38
    }
39

40
    public @NotNull MapPropertyBuilder<V, M, P> defaultValue(@NotNull Map<String, V> defaultValue) {
41
        this.defaultValue.clear();
×
42
        this.defaultValue.putAll(defaultValue);
×
43
        return this;
×
44
    }
45

46
    public @NotNull P build() {
47
        PropertyBuilderUtils.requireNonNullPath(path);
×
48
        return createPropertyFunction.apply(path, defaultValue);
×
49
    }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc