• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

link-intersystems / lis-commons / #264

05 Nov 2023 11:38AM UTC coverage: 88.527% (-1.3%) from 89.804%
#264

Pull #7

renelink
Added tests.
Pull Request #7: Migrated swing-view stuff from java-swing-mvc-plugin-architecture.

249 of 400 new or added lines in 23 files covered. (62.25%)

7639 of 8629 relevant lines covered (88.53%)

0.89 hits per line

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

65.63
/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.function.Consumer;
4
import java.util.function.Supplier;
5
import java.util.stream.Stream;
6

7
public interface Context {
8

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

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

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

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

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

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

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

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

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

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

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

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

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

57
    default <T> T get(Class<T> type) throws ContextObjectException {
58
        return get(type, null);
1✔
59
    }
60

61
    default <T> T get(Class<T> type, String name) throws ContextObjectException {
62
        return get(new ObjectQualifier<>(type, name));
1✔
63
    }
64

65
    <T> T get(ObjectQualifier<T> objectQualifier) throws ContextObjectException;
66

67
    default public <T> Supplier<T> getSupplier(Class<T> type) {
NEW
68
        return getSupplier(type, null);
×
69
    }
70

71
    default public <T> Supplier<T> getSupplier(Class<T> type, String name) {
NEW
72
        return getSupplier(new ObjectQualifier<>(type, name));
×
73
    }
74

75
    default public <T> Supplier<T> getSupplier(ObjectQualifier<T> objectQualifier) {
NEW
76
        return () -> get(objectQualifier);
×
77
    }
78

79
    default <T> boolean remove(Class<? super T> type) {
80
        return remove(type, null);
1✔
81
    }
82

83
    default <T> boolean remove(Class<? super T> type, String name) {
84
        ObjectQualifier<? super T> objectQualifier = new ObjectQualifier<>(type, name);
1✔
85
        return remove(objectQualifier);
1✔
86
    }
87

88
    boolean remove(ObjectQualifier<?> objectQualifier);
89

90
    default <T, O extends T> void put(Class<T> type, O object) throws ContextObjectException {
91
        put(type, null, object);
1✔
92
    }
1✔
93

94
    default <T, O extends T> void put(Class<? super T> type, String name, O object) throws ContextObjectException {
95
        put(new ObjectQualifier<>(type, name), object);
1✔
96
    }
1✔
97

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

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