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

org.jline.reader.impl.completer.EnumCompleter Maven / Gradle / Ivy

There is a newer version: 3.26.3
Show newest version
/*
 * Copyright (c) 2002-2016, 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.
 *
 * https://opensource.org/licenses/BSD-3-Clause
 */
package org.jline.reader.impl.completer;

import java.util.Objects;

import org.jline.reader.Candidate;
import org.jline.reader.Completer;

/**
 * {@link Completer} for {@link Enum} names.
 *
 * @author Jason Dillon
 * @since 2.3
 */
public class EnumCompleter extends StringsCompleter
{
    public EnumCompleter(Class> source) {
        Objects.requireNonNull(source);
        for (Enum n : source.getEnumConstants()) {
            candidates.add(new Candidate(n.name().toLowerCase()));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy