Class ContextServiceImpl<C>

java.lang.Object
com.cumulocity.microservice.context.ContextServiceImpl<C>
All Implemented Interfaces:
ContextService<C>

public class ContextServiceImpl<C> extends Object implements ContextService<C>
  • Constructor Details

    • ContextServiceImpl

      public ContextServiceImpl(Class<C> c)
  • Method Details

    • getContext

      public C getContext()
      Description copied from interface: ContextService
      Gets entered context
      Specified by:
      getContext in interface ContextService<C>
      Returns:
      entered context
    • isInContext

      public boolean isInContext()
      Description copied from interface: ContextService
      Returns true if context is found.
      Specified by:
      isInContext in interface ContextService<C>
      Returns:
      true if context is found; false otherwise
    • runWithinContext

      public void runWithinContext(C context, Runnable task)
      Description copied from interface: ContextService
      Enters context to run with Runnable task
      Specified by:
      runWithinContext in interface ContextService<C>
      Parameters:
      context - the credentials to access the Cumulocity platform
      task - Runnable task
    • callWithinContext

      public <V> V callWithinContext(C context, Callable<V> task)
      Description copied from interface: ContextService
      Enters context to run with Callable task
      Specified by:
      callWithinContext in interface ContextService<C>
      Type Parameters:
      V - generic type of Callable
      Parameters:
      context - the credentials to access the Cumulocity platform
      task - Callable task
      Returns:
      the returned value from the Callable task
    • withinContext

      public Runnable withinContext(C context, Runnable task)
      Description copied from interface: ContextService
      Enters context to run with Runnable task and returns the task with context
      Specified by:
      withinContext in interface ContextService<C>
      Parameters:
      context - the credentials to access the Cumulocity platform
      task - Runnable task
      Returns:
      Runnable task with context
    • withinContext

      public <V> Callable<V> withinContext(C context, Callable<V> task)
      Description copied from interface: ContextService
      Enters context to run with Callable task and returns the task with context
      Specified by:
      withinContext in interface ContextService<C>
      Type Parameters:
      V - generic type of Callable
      Parameters:
      context - the credentials to access the Cumulocity platform
      task - Callable task
      Returns:
      Callable task with context