commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <in...@Synygy.com>
Subject RE: [math] - Multiple Linear Regression
Date Wed, 28 Jan 2004 19:39:42 GMT
I was thinking something in the way of something like this.
I'm not sure what pattern it fits into.  It's sort of a combination
of a factory and a singleton:

package org.apache.commons.math.util;

public class Resources {

    private Resources() { ... }
    private Resources(Locale locale) { ... }
    private Object getObject(String key);
    private String getString(String key);
    private String getString(String key, Object param1);
    private String getString(String key, Object param1, Object param2);
    private String getString(String key, Object params[]);

    private static Map instances = new Hashtable();

    public  static Resources getResources() {
       return getResources(Locale.getDefault());
    }

    public  static Resources getResources(Locale locale) {
       Resources r = (Resources)instances.get(locale);
       if (r == null) {
            r = new Resources(locale);
            instances.put(locale, r);
       }
       return r;
    }
}

Of course, the private constructors would load the ResourceBundle
objects based on the locale that is given.  I'm almost thinking that
there should be something like this in Lang, or even a seperate project,
and that a project like math could use a parameterized version of it.
But in the mean time, I think something like this would be good.

Usage:

	Resources r = Resources.getResources();
      String msg = r.getString(key);

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
Sent: Wednesday, January 28, 2004 2:30 PM
To: Jakarta Commons Developers List
Subject: Re: [math] - Multiple Linear Regression


Inger, Matthew wrote:
> Has there been any though to resource bundle usage
> in commons/math?

No. Contributions are welcome, we've got other messages
in need of i18n as well.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message