--- /dev/null 2015-04-26 06:51:08.003313989 -0700 +++ new/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/completer/EnumCompleter.java 2015-07-02 08:21:38.248707473 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2002-2012, the original author or authors. + * + * This software is distributable under the BSD license. See the terms of the + * BSD license in the documentation provided with this software. + * + * http://www.opensource.org/licenses/bsd-license.php + */ +package jdk.internal.jline.console.completer; + +import static jdk.internal.jline.internal.Preconditions.checkNotNull; + +/** + * {@link Completer} for {@link Enum} names. + * + * @author Jason Dillon + * @since 2.3 + */ +public class EnumCompleter + extends StringsCompleter +{ + public EnumCompleter(Class> source) { + checkNotNull(source); + + for (Enum n : source.getEnumConstants()) { + this.getStrings().add(n.name().toLowerCase()); + } + } +}