Class CachingPCMModelCommandExecutor

  • All Implemented Interfaces:
    ICommandExecutor<PCMModel>

    public class CachingPCMModelCommandExecutor
    extends Object
    implements ICommandExecutor<PCMModel>
    Use this class to execute ICommands requiring access to a PCM model. Commands that are cachable, are executed only once. Further executions of the same command are served from the cache.

    In order to be cached, the isCachable() method of the command must return true.

    • Constructor Detail

      • CachingPCMModelCommandExecutor

        public CachingPCMModelCommandExecutor​(PCMModel pcm)
        Constructs an executor that is capable of executing ICommands operating on PCM models. Additionally, the commands are served from cache, if caching is enabled for the command and the command has been executed before.
        Parameters:
        pcm - the PCM model on which the executed commands are to operate
    • Method Detail

      • execute

        public <T> T execute​(ICommand<T,​PCMModel> command)
        Executes the specified command.
        Specified by:
        execute in interface ICommandExecutor<PCMModel>
        Parameters:
        command - the command that is to be executed
        Returns:
        the result of executing the specified command, or null if the return type (T) is Void.