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

com.memority.toolkit.inwebo.api.Language Maven / Gradle / Ivy

/*
 * Copyright (c) 2016-2023 Memority. All Rights Reserved.
 *
 * This file is part of Memority Toolkit API , a Memority project.
 *
 * This file is released under the Memority Public Artifacts End-User License Agreement,
 * see 
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 */
package com.memority.toolkit.inwebo.api;

import java.util.Arrays;

/**
 * InWebo user language.
 * Used for setting language in Virtual Authenticator or Helium.
 * Value in InWebo API is a string.
 */
public enum Language {
    FRENCH("fr"),
    ENGLISH("en"),
    UNDEFINED("");

    private String apiValue;

    Language(String apiValue) {
        this.apiValue = apiValue;
    }

    public static Language getFromApiValue(String apiValue) {
        if (apiValue.isEmpty()) {
            return null;
        }

        return Arrays.stream(Language.values())
                .filter(v -> v.apiValue.equals(apiValue))
                .findFirst().orElseThrow(IllegalArgumentException::new);
    }

    public String getApiValue() {
        return apiValue;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy