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

org.bidib.wizard.model.status.FlagStatus 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.FlagEnum;

public enum FlagStatus implements BidibStatus {
    // @formatter:off
    CLEAR(FlagEnum.CLEAR, "clear"), QUERY_1(FlagEnum.QUERY1, "query1"), QUERY_0(FlagEnum.QUERY0, "query0"), SET(
        FlagEnum.SET, "set");
    // @formatter:on

    private final FlagEnum type;

    private final String key;

    FlagStatus(FlagEnum type, String key) {
        this.type = type;
        this.key = key;
    }

    @Override
    public FlagEnum getType() {
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    public static FlagStatus valueOf(FlagEnum type) {
        FlagStatus result = null;

        for (FlagStatus e : values()) {
            if (e.type == type) {
                result = e;
                break;
            }
        }
        if (result == null) {
            throw new IllegalArgumentException("cannot map " + type + " to a flag status");
        }
        return result;
    }

    @Override
    public FlagStatus[] getValues() {
        return new FlagStatus[] { CLEAR, QUERY_1, QUERY_0, SET };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy