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

org.infinispan.cli.completers.EnumCompleter Maven / Gradle / Ivy

package org.infinispan.cli.completers;

import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;

import org.infinispan.cli.Context;

/**
 * @author Tristan Tarrant <[email protected]>
 * @since 12.0
 **/
public abstract class EnumCompleter> extends ListCompleter {

   private final Set enumSet;

   public EnumCompleter(Class theEnum) {
      EnumSet all = EnumSet.allOf(theEnum);
      this.enumSet = new HashSet<>(all.size());
      all.forEach(e -> enumSet.add(e.name()));
   }

   @Override
   Collection getAvailableItems(Context context) {
      return enumSet;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy