Package it.tidalwave.role
Class ContextManager.Locator
- java.lang.Object
-
- it.tidalwave.role.ContextManager.Locator
-
- Enclosing interface:
- ContextManager
public static final class ContextManager.Locator extends java.lang.Object
A locator for theContextManager
which uses theServiceLoader
facility to be independent of any DI framework. This locator caches the internal reference and this is ok for production use; during tests, since multiple contexts are typically created and destroyed for each test, you should callreset()
after each test has been completed.
-
-
Constructor Summary
Constructors Constructor Description Locator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ContextManager
find()
static void
reset()
This method is for testing only. Resets the globalContextManagerProvider
; it must be called at the test completion wheneverset(ContextManagerProvider)
has been called, to avoid polluting the context of further tests.static void
set(ContextManagerProvider provider)
This method is for testing only. Sets the globalContextManagerProvider
.
-
-
-
Method Detail
-
find
@Nonnull public static ContextManager find()
-
set
public static void set(@Nonnull ContextManagerProvider provider)
This method is for testing only. Sets the globalContextManagerProvider
. See note aboutreset()
.- Parameters:
provider
- the provider- See Also:
reset()
-
reset
public static void reset()
This method is for testing only. Resets the globalContextManagerProvider
; it must be called at the test completion wheneverset(ContextManagerProvider)
has been called, to avoid polluting the context of further tests.- See Also:
set(ContextManagerProvider)
-
-