org.bidib.wizard.model.status.CriticalFunctionStatus 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.CriticalFunctionEnum;
public enum CriticalFunctionStatus implements BidibStatus {
// @formatter:off
BEGIN(CriticalFunctionEnum.BEGIN, "begin"), END(CriticalFunctionEnum.END, "end");
// @formatter:on
private final CriticalFunctionEnum type;
private final String key;
CriticalFunctionStatus(CriticalFunctionEnum type, String key) {
this.type = type;
this.key = key;
}
@Override
public CriticalFunctionEnum getType() {
return type;
}
@Override
public String getKey() {
return key;
}
public static CriticalFunctionStatus valueOf(CriticalFunctionEnum type) {
CriticalFunctionStatus result = null;
for (CriticalFunctionStatus e : values()) {
if (e.type == type) {
result = e;
break;
}
}
if (result == null) {
throw new IllegalArgumentException("cannot map " + type + " to a critical function status");
}
return result;
}
@Override
public CriticalFunctionStatus[] getValues() {
return new CriticalFunctionStatus[] { BEGIN, END };
}
}