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

net.yudichev.jiotty.appliance.EnumCommands Maven / Gradle / Ivy

package net.yudichev.jiotty.appliance;

import java.util.Set;
import java.util.stream.Stream;

import static com.google.common.collect.ImmutableSet.toImmutableSet;

public final class EnumCommands {
    private EnumCommands() {
    }

    public static  & Command> Set> createMetasForSimpleEnumCommand(T[] allEnumValues) {
        return Stream.of(allEnumValues)
                .map(enumCommand -> CommandMeta.builder()
                        .setCommandName(enumCommand.name())
                        .setCommandFactory(parameters -> enumCommand)
                        .build())
                .collect(toImmutableSet());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy