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

org.bidib.wizard.model.status.CriticalFunctionStatus Maven / Gradle / Ivy

There is a newer version: 2.0.29
Show newest version
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 };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy