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

com.aliyun.openservices.ots.utils.ResourceManager Maven / Gradle / Ivy

package com.aliyun.openservices.ots.utils;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

/**
 * Manager class to get localized resources.
 *
 */
public class ResourceManager {
    private ResourceBundle bundle;

    ResourceManager(String baseName, Locale locale){
        this.bundle = ResourceBundle.getBundle(baseName, locale);
    }

    public static ResourceManager getInstance(String baseName){
        return new ResourceManager(baseName, Locale.getDefault());
    }

    public static ResourceManager getInstance(String baseName, Locale locale){
        return new ResourceManager(baseName, locale);
    }

    public String getString(String key){
        return bundle.getString(key);
    }

    public String getFormattedString(String key, Object... args){
        return MessageFormat.format(getString(key), args);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy