Class ContextServiceImpl<C>
java.lang.Object
com.cumulocity.microservice.context.ContextServiceImpl<C>
- All Implemented Interfaces:
ContextService<C>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V> VcallWithinContext(C context, Callable<V> task) Enters context to run with Callable taskGets entered contextbooleanReturnstrueif context is found.voidrunWithinContext(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:ContextServiceGets entered context- Specified by:
getContextin interfaceContextService<C>- Returns:
- entered context
-
isInContext
public boolean isInContext()Description copied from interface:ContextServiceReturnstrueif context is found.- Specified by:
isInContextin interfaceContextService<C>- Returns:
trueif context is found;falseotherwise
-
runWithinContext
Description copied from interface:ContextServiceEnters context to run with Runnable task- Specified by:
runWithinContextin interfaceContextService<C>- Parameters:
context- the credentials to access the Cumulocity platformtask- Runnable task
-
callWithinContext
Description copied from interface:ContextServiceEnters context to run with Callable task- Specified by:
callWithinContextin 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:ContextServiceEnters context to run with Runnable task and returns the task with context- Specified by:
withinContextin interfaceContextService<C>- Parameters:
context- the credentials to access the Cumulocity platformtask- Runnable task- Returns:
- Runnable task with context
-
withinContext
Description copied from interface:ContextServiceEnters context to run with Callable task and returns the task with context- Specified by:
withinContextin 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
-