net.yudichev.jiotty.appliance.PowerCommand Maven / Gradle / Ivy
package net.yudichev.jiotty.appliance;
import java.util.Optional;
public enum PowerCommand implements Command {
ON,
OFF;
@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);
}
}