Class ContextServiceImpl<C>

    • Constructor Detail

      • ContextServiceImpl

        public ContextServiceImpl​(Class<C> c)
    • Method Detail

      • 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