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

org.dsa.iot.dslink.node.Writable Maven / Gradle / Ivy

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

/**
 * @author Samuel Grenier
 */
public enum Writable {

    /**
     * Whether anyone can write to the value.
     */
    WRITE,

    /**
     * Whether configuration permissions are required to write to the value.
     */
    CONFIG,

    /**
     * Can never write to the value.
     */
    NEVER;

    public String toJsonName() {
        return this.toString().toLowerCase();
    }

    public static Writable toEnum(String writable) {
        if (writable == null) {
            return NEVER;
        }
        switch (writable) {
            case "write":
                return WRITE;
            case "config":
                return CONFIG;
            case "never":
                return NEVER;
            default:
                throw new RuntimeException("Unhandled writable permission: " + writable);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy