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;
}
}