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

link-intersystems / lis-commons / #295

06 Nov 2023 09:54AM UTC coverage: 89.092% (-1.0%) from 90.072%
#295

Pull #7

renelink
Run build with xvfb to support swing tests.
Pull Request #7: Migrated swing-view stuff from java-swing-mvc-plugin-architecture.

318 of 451 new or added lines in 28 files covered. (70.51%)

8029 of 9012 relevant lines covered (89.09%)

0.89 hits per line

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

56.76
/lis-commons-util-context/src/main/java/com/link_intersystems/util/context/Context.java
1
package com.link_intersystems.util.context;
2

3
import java.util.Optional;
4
import java.util.function.Consumer;
5
import java.util.function.Supplier;
6
import java.util.stream.Stream;
7

8
public interface Context {
9

10
    default <T> void addViewContextListener(Class<? super T> type, ContextListener<T> contextListener) {
11
        addViewContextListener(type, null, contextListener);
1✔
12
    }
1✔
13

14
    default <T> void addViewContextListener(Class<? super T> type, String name, ContextListener<T> contextListener) {
15
        ObjectQualifier<? super T> objectQualifier = new ObjectQualifier<>(type, name);
1✔
16

17
        addViewContextListener(objectQualifier, contextListener);
1✔
18
    }
1✔
19

20
    <T> void addViewContextListener(ObjectQualifier<? super T> objectQualifier, ContextListener<T> contextListener);
21

22
    default <T> void removeViewContextListener(Class<? super T> type, ContextListener<T> contextListener) {
23
        removeViewContextListener(type, null, contextListener);
1✔
24
    }
1✔
25

26
    default <T> void removeViewContextListener(Class<? super T> type, String name, ContextListener<T> contextListener) {
27
        ObjectQualifier<? super T> objectQualifier = new ObjectQualifier<>(type, name);
1✔
28
        removeViewContextListener(objectQualifier, contextListener);
1✔
29
    }
1✔
30

31
    <T> void removeViewContextListener(ObjectQualifier<? super T> objectQualifier, ContextListener<T> contextListener);
32

33
    default boolean contains(Class<?> type) {
34
        return contains(type, null);
1✔
35
    }
36

37
    default boolean contains(Class<?> type, String name) {
38
        return contains(new ObjectQualifier<>(type, name));
1✔
39
    }
40

41
    boolean contains(ObjectQualifier<?> objectQualifier);
42

43
    default <T> void ifContains(Class<T> type, Consumer<T> objectConsumer) {
NEW
44
        ifContains(type, null, objectConsumer);
×
NEW
45
    }
×
46

47
    default <T> void ifContains(Class<T> type, String name, Consumer<T> objectConsumer) {
NEW
48
        ifContains(new ObjectQualifier<>(type, name), objectConsumer);
×
NEW
49
    }
×
50

51
    default <T> void ifContains(ObjectQualifier<T> objectQualifier, Consumer<T> objectConsumer) {
NEW
52
        if (contains(objectQualifier)) {
×
NEW
53
            T object = get(objectQualifier);
×
NEW
54
            objectConsumer.accept(object);
×
55
        }
NEW
56
    }
×
57

58
    default <T> Optional<T> find(Class<T> type) throws ContextObjectException {
NEW
59
        return find(type, null);
×
60
    }
61

62
    default <T> Optional<T> find(Class<T> type, String name) throws ContextObjectException {
NEW
63
        return find(new ObjectQualifier<>(type, name));
×
64
    }
65

66
    default <T> Optional<T> find(ObjectQualifier<T> objectQualifier) throws ContextObjectException {
NEW
67
        if (contains(objectQualifier)) {
×
NEW
68
            return Optional.of(get(objectQualifier));
×
69
        }
NEW
70
        return Optional.empty();
×
71
    }
72

73
    default <T> T get(Class<T> type) throws ContextObjectException {
74
        return get(type, null);
1✔
75
    }
76

77
    default <T> T get(Class<T> type, String name) throws ContextObjectException {
78
        return get(new ObjectQualifier<>(type, name));
1✔
79
    }
80

81
    <T> T get(ObjectQualifier<T> objectQualifier) throws ContextObjectException;
82

83
    default public <T> Supplier<T> getSupplier(Class<T> type) {
NEW
84
        return getSupplier(type, null);
×
85
    }
86

87
    default public <T> Supplier<T> getSupplier(Class<T> type, String name) {
NEW
88
        return getSupplier(new ObjectQualifier<>(type, name));
×
89
    }
90

91
    default public <T> Supplier<T> getSupplier(ObjectQualifier<T> objectQualifier) {
NEW
92
        return () -> get(objectQualifier);
×
93
    }
94

95
    default <T> boolean remove(Class<? super T> type) {
96
        return remove(type, null);
1✔
97
    }
98

99
    default <T> boolean remove(Class<? super T> type, String name) {
100
        ObjectQualifier<? super T> objectQualifier = new ObjectQualifier<>(type, name);
1✔
101
        return remove(objectQualifier);
1✔
102
    }
103

104
    boolean remove(ObjectQualifier<?> objectQualifier);
105

106
    default <T, O extends T> void put(Class<T> type, O object) throws ContextObjectException {
107
        put(type, null, object);
1✔
108
    }
1✔
109

110
    default <T, O extends T> void put(Class<? super T> type, String name, O object) throws ContextObjectException {
111
        put(new ObjectQualifier<>(type, name), object);
1✔
112
    }
1✔
113

114
    <T, O extends T> void put(ObjectQualifier<? super T> objectQualifier, O object) throws ContextObjectException;
115

116
    public Stream<QualifiedObject<?>> stream();
117
}
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