Class ContextServiceImpl<C>
java.lang.Object
com.cumulocity.microservice.context.ContextServiceImpl<C>
- All Implemented Interfaces:
ContextService<C>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V> V
callWithinContext
(C context, Callable<V> task) Enters context to run with Callable taskGets entered contextboolean
Returnstrue
if context is found.void
runWithinContext
(C context, Runnable task) Enters context to run with Runnable taskwithinContext
(C context, Runnable task) Enters context to run with Runnable task and returns the task with context<V> Callable<V>
withinContext
(C context, Callable<V> task) Enters context to run with Callable task and returns the task with context
-
Constructor Details
-
ContextServiceImpl
-
-
Method Details
-
getContext
Description copied from interface:ContextService
Gets entered context- Specified by:
getContext
in interfaceContextService<C>
- Returns:
- entered context
-
isInContext
public boolean isInContext()Description copied from interface:ContextService
Returnstrue
if context is found.- Specified by:
isInContext
in interfaceContextService<C>
- Returns:
true
if context is found;false
otherwise
-
runWithinContext
Description copied from interface:ContextService
Enters context to run with Runnable task- Specified by:
runWithinContext
in interfaceContextService<C>
- Parameters:
context
- the credentials to access the Cumulocity platformtask
- Runnable task
-
callWithinContext
Description copied from interface:ContextService
Enters context to run with Callable task- Specified by:
callWithinContext
in interfaceContextService<C>
- Type Parameters:
V
- generic type of Callable- Parameters:
context
- the credentials to access the Cumulocity platformtask
- Callable task- Returns:
- the returned value from the Callable task
-
withinContext
Description copied from interface:ContextService
Enters context to run with Runnable task and returns the task with context- Specified by:
withinContext
in interfaceContextService<C>
- Parameters:
context
- the credentials to access the Cumulocity platformtask
- Runnable task- Returns:
- Runnable task with context
-
withinContext
Description copied from interface:ContextService
Enters context to run with Callable task and returns the task with context- Specified by:
withinContext
in interfaceContextService<C>
- Type Parameters:
V
- generic type of Callable- Parameters:
context
- the credentials to access the Cumulocity platformtask
- Callable task- Returns:
- Callable task with context
-