Interface ApplicationContextHolderStrategy
-
- All Implemented Interfaces:
public interface ApplicationContextHolderStrategy
-
-
Method Summary
Modifier and Type Method Description abstract <T extends ApplicationContext> KClass<T>supportedApplicationContextType()Get type of context supported by this holder strategy abstract ApplicationContextgetContext(String name)Get a context for given name. abstract ApplicationContextgetContext(String name, Set<Key<?>> permittedKeys)Same as getContext but with permittedKeys. abstract UnitsetContext(ApplicationContext applicationContext)Set any externally created context into the context holder strategy. abstract ApplicationContextclearContext(String name)Clear context for given name and return back the context abstract BooleanexistsContext(String name, Set<Key<?>> permittedKeys)Check if context with given name and permittedKeys exists in this context holder strategy abstract CoroutineScopeinitCoroutineScope(CoroutineScope coroutineScope)Initialize a new CoroutineScope which can hold ApplicationContext for all coroutines that use this scope -
-
Method Detail
-
supportedApplicationContextType
abstract <T extends ApplicationContext> KClass<T> supportedApplicationContextType()
Get type of context supported by this holder strategy
- Returns:
- </T>
-
getContext
abstract ApplicationContext getContext(String name)
Get a context for given name. If not available then create one, set in holder and return back.
-
getContext
abstract ApplicationContext getContext(String name, Set<Key<?>> permittedKeys)
Same as getContext but with permittedKeys. If context already exist with different set of keys then this method should throw InvalidKeyException
-
setContext
abstract Unit setContext(ApplicationContext applicationContext)
Set any externally created context into the context holder strategy. If any context with this name already exist then this method should throw InvalidContextException
-
clearContext
abstract ApplicationContext clearContext(String name)
Clear context for given name and return back the context
-
existsContext
abstract Boolean existsContext(String name, Set<Key<?>> permittedKeys)
Check if context with given name and permittedKeys exists in this context holder strategy
-
initCoroutineScope
abstract CoroutineScope initCoroutineScope(CoroutineScope coroutineScope)
Initialize a new CoroutineScope which can hold ApplicationContext for all coroutines that use this scope
- Parameters:
coroutineScope- if any existing coroutineScope passed then a new coroutineScope is created from that param and init for holding ApplicationContext
-
-
-
-