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

talsma-ict / context-propagation / #1509

06 Nov 2024 12:09PM UTC coverage: 78.515% (-13.2%) from 91.679%
#1509

Pull #515

sjoerdtalsma
Remove deprecated priority comparator mechanism (including service caching).

Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Pull Request #515: Cleanup deprecations to develop next major version (v2)

114 of 169 new or added lines in 25 files covered. (67.46%)

141 existing lines in 7 files now uncovered.

994 of 1266 relevant lines covered (78.52%)

0.79 hits per line

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

0.0
/context-propagation/src/main/java/nl/talsmasoftware/context/observer/ContextObservers.java
1
/*
2
 * Copyright 2016-2024 Talsma ICT
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *         http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package nl.talsmasoftware.context.observer;
17

18
import nl.talsmasoftware.context.ContextManager;
19
import nl.talsmasoftware.context.ContextManagers;
20

21
/**
22
 * Utility class to assist Context implementors.
23
 * <p>
24
 * It implements the SPI behaviour, locating appropriate {@linkplain ContextObserver}
25
 * implementations to be notified of {@linkplain #onActivate(Class, Object, Object) activate}
26
 * and {@linkplain #onDeactivate(Class, Object, Object) deactivate} occurrances.
27
 *
28
 * @author Sjoerd Talsma
29
 * @see nl.talsmasoftware.context.core.ContextManagers#registerContextObserver(nl.talsmasoftware.context.api.ContextObserver, Class)
30
 * @see nl.talsmasoftware.context.core.ContextManagers#unregisterContextObserver(nl.talsmasoftware.context.api.ContextObserver)
31
 * @deprecated Replaced by explicit ContextManager registration.
32
 */
33
@Deprecated
34
public final class ContextObservers {
35

36
    /**
37
     * Private constructor to avoid instantiation of this class.
38
     */
UNCOV
39
    private ContextObservers() {
×
UNCOV
40
        throw new UnsupportedOperationException();
×
41
    }
42

43
    /**
44
     * Notifies all {@linkplain ContextObserver context observers} for the specified {@code contextManager}
45
     * about the activated context value.
46
     *
47
     * @param contextManager        The context manager type that activated the context (required to observe).
48
     * @param activatedContextValue The activated context value or {@code null} if no value was activated.
49
     * @param previousContextValue  The previous context value or {@code null} if unknown or unsupported.
50
     * @param <T>                   The type managed by the context manager.
51
     * @see ContextManagers#onActivate(Class, Object, Object)
52
     * @deprecated This method was moved to the {@code ContextManagers} utility class.
53
     */
54
    @Deprecated
55
    public static <T> void onActivate(Class<? extends ContextManager<? super T>> contextManager,
56
                                      T activatedContextValue,
57
                                      T previousContextValue) {
UNCOV
58
        ContextManagers.onActivate(contextManager, activatedContextValue, previousContextValue);
×
UNCOV
59
    }
×
60

61
    /**
62
     * Notifies all {@linkplain ContextObserver context observers} for the specified {@code contextManager}
63
     * about the deactivated context value.
64
     *
65
     * @param contextManager          The context manager type that deactivated the context (required to observe).
66
     * @param deactivatedContextValue The deactivated context value
67
     * @param restoredContextValue    The restored context value or {@code null} if unknown or unsupported.
68
     * @param <T>                     The type managed by the context manager.
69
     * @see ContextManagers#onDeactivate(Class, Object, Object)
70
     * @deprecated This method was moved to the {@code ContextManagers} utility class.
71
     */
72
    @Deprecated
73
    public static <T> void onDeactivate(Class<? extends ContextManager<? super T>> contextManager,
74
                                        T deactivatedContextValue,
75
                                        T restoredContextValue) {
UNCOV
76
        ContextManagers.onDeactivate(contextManager, deactivatedContextValue, restoredContextValue);
×
UNCOV
77
    }
×
78

79
}
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

© 2025 Coveralls, Inc