org.bidib.wizard.model.status.MacroStatus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-model Show documentation
Show all versions of bidibwizard-model Show documentation
jBiDiB BiDiB Wizard Model POM
package org.bidib.wizard.model.status;
import org.bidib.jbidibc.messages.enums.MacroEnum;
public enum MacroStatus implements BidibStatus {
// @formatter:off
START(MacroEnum.START, "start"), STOP(MacroEnum.STOP, "stop"), END(MacroEnum.END, "end");
// @formatter:on
private final MacroEnum type;
private final String key;
MacroStatus(MacroEnum type, String key) {
this.type = type;
this.key = key;
}
@Override
public MacroEnum getType() {
return type;
}
@Override
public String getKey() {
return key;
}
public static MacroStatus valueOf(MacroEnum type) {
MacroStatus result = null;
for (MacroStatus e : values()) {
if (e.type == type) {
result = e;
break;
}
}
if (result == null) {
throw new IllegalArgumentException("cannot map " + type + " to a macro status");
}
return result;
}
@Override
public MacroStatus[] getValues() {
return new MacroStatus[] { START, STOP /* , END */ };
}
}