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

org.dsa.iot.dslink.methods.StreamState Maven / Gradle / Ivy

There is a newer version: 0.24.2
Show newest version
package org.dsa.iot.dslink.methods;

/**
 * Possible states that a method can be in.
 *
 * @author Samuel Grenier
 */
public enum StreamState {

    INITIALIZED("initialize"),
    OPEN("open"),
    CLOSED("closed");

    private final String jsonName;

    StreamState(String jsonName) {
        this.jsonName = jsonName;
    }

    public String getJsonName() {
        return jsonName;
    }

    public static StreamState toEnum(String stream) {
        if (stream == null) {
            return null;
        }
        switch (stream) {
            case "initialize":
                return INITIALIZED;
            case "open":
                return OPEN;
            case "closed":
                return CLOSED;
            default:
                throw new RuntimeException("Unknown stream type: " + stream);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy