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

org.ar4k.agent.industrial.validators.CryptoModeValuesProvider Maven / Gradle / Ivy

/*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see .
    */
package org.ar4k.agent.industrial.validators;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.ar4k.agent.industrial.Enumerator.CryptoMode;
import org.springframework.core.MethodParameter;
import org.springframework.shell.CompletionContext;
import org.springframework.shell.CompletionProposal;
//import org.springframework.shell.CompletionContext;
//import org.springframework.shell.CompletionProposal;
import org.springframework.shell.standard.ValueProviderSupport;
import org.springframework.stereotype.Component;

/**
 * @author Andrea Ambrosini Rossonet s.c.a r.l. [email protected]
 * 
 *         Provider per autocompletamento status da linea di comando
 *         (interazione con TAB).
 */
@Component
public class CryptoModeValuesProvider extends ValueProviderSupport {

	private final static String[] VALUES = Stream.of(CryptoMode.values()).map(CryptoMode::name).toArray(String[]::new);

	@Override
	public List complete(MethodParameter parameter, CompletionContext completionContext,
			String[] hints) {
		return Arrays.stream(VALUES).map(CompletionProposal::new).collect(Collectors.toList());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy