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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy