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

com.opensymphony.xwork2.TextProviderFactory Maven / Gradle / Ivy

Go to download

XWork is an command-pattern framework that is used to power WebWork as well as other applications. XWork provides an Inversion of Control container, a powerful expression language, data type conversion, validation, and pluggable configuration.

There is a newer version: 2.0.3
Show newest version
/*
 * Copyright (c) 2002-2007 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.xwork2;

import java.util.ResourceBundle;

/**
 * TextProviderFactory
 *
 * @author Oleg Gorobets
 */
public class TextProviderFactory {

    private static TextProvider instance = new TextProviderSupport();

    /**
     * @param instance Text provider
     */
    public static void setInstance(TextProvider instance) {
        TextProviderFactory.instance = instance;
    }

    public static TextProvider getInstance() {
        return instance;
    }

    public static TextProvider getInstance(Class clazz, LocaleProvider provider) {
        if (instance instanceof TextProviderSupport) {
            ((TextProviderSupport) instance).setClazz(clazz);
            ((TextProviderSupport) instance).setLocaleProvider(provider);
        }
        return instance;
    }

    public static TextProvider getInstance(ResourceBundle bundle, LocaleProvider provider) {
        if (instance instanceof TextProviderSupport) {
            ((TextProviderSupport) instance).setBundle(bundle);
            ((TextProviderSupport) instance).setLocaleProvider(provider);
        }
        return instance;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy