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

org.opensearch.ml.common.AccessMode Maven / Gradle / Ivy

The newest version!
/*
 *
 *  * Copyright OpenSearch Contributors
 *  * SPDX-License-Identifier: Apache-2.0
 *
 */

package org.opensearch.ml.common;

import java.util.HashMap;
import java.util.Map;

import lombok.Getter;

public enum AccessMode {
    PUBLIC("public"),
    PRIVATE("private"),
    RESTRICTED("restricted");

    @Getter
    private String value;

    AccessMode(String value) {
        this.value = value;
    }

    private static final Map cache = new HashMap<>();

    static {
        for (AccessMode modelAccessMode : values()) {
            cache.put(modelAccessMode.value, modelAccessMode);
        }
    }

    public static AccessMode from(String value) {
        try {
            return cache.get(value);
        } catch (Exception e) {
            throw new IllegalArgumentException("Wrong access value");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy