net.yudichev.jiotty.appliance.PowerCommand Maven / Gradle / Ivy
package net.yudichev.jiotty.appliance;
import java.util.Optional;
import java.util.Set;
import static net.yudichev.jiotty.appliance.EnumCommands.createMetasForSimpleEnumCommand;
public enum PowerCommand implements Command {
ON,
OFF;
private static final Set> ALL_METAS = createMetasForSimpleEnumCommand(values());
public static Set> allPowerCommandMetas() {
return ALL_METAS;
}
@Override
public Optional accept(Command.Visitor visitor) {
return visitor instanceof Visitor ?
Optional.of(((Visitor) visitor).visit(this)) :
Optional.empty();
}
@SuppressWarnings("ClassNameSameAsAncestorName") // by design
public interface Visitor extends Command.Visitor {
T visit(PowerCommand command);
}
}