All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.cli.activators.ContextAwareCommandActivatorProvider Maven / Gradle / Ivy

package org.infinispan.cli.activators;

import java.util.Objects;

import org.aesh.command.activator.CommandActivator;
import org.aesh.command.activator.CommandActivatorProvider;
import org.infinispan.cli.Context;

/**
 * @author Tristan Tarrant <[email protected]>
 * @since 10.0
 **/
public class ContextAwareCommandActivatorProvider implements CommandActivatorProvider {

   private final Context context;

   public ContextAwareCommandActivatorProvider(Context context) {
      Objects.requireNonNull(context);
      this.context = context;
   }

   @Override
   public CommandActivator enhanceCommandActivator(CommandActivator commandActivator) {
      if (commandActivator instanceof ContextAwareCommandActivator) {
         ((ContextAwareCommandActivator) commandActivator).setContext(context);
      }
      return commandActivator;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy