You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/09/28 23:15:23 UTC

cvs commit: jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources Messages.java

dgraham     2003/09/28 14:15:23

  Modified:    resources/src/java/org/apache/commons/resources
                        Messages.java
  Log:
  Attach array [] to variable type rather than name (ie.
  Object[] args instead of Object args[]).  Removed unused
  defaultLocale variable.
  
  Revision  Changes    Path
  1.5       +28 -39    jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Messages.java
  
  Index: Messages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Messages.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Messages.java	19 Mar 2003 19:02:07 -0000	1.4
  +++ Messages.java	28 Sep 2003 21:15:23 -0000	1.5
  @@ -61,15 +61,11 @@
   
   package org.apache.commons.resources;
   
  -
   import java.io.Serializable;
   import java.text.MessageFormat;
   import java.util.Locale;
  -import org.apache.commons.resources.Resources;
  -import org.apache.commons.resources.ResourcesException;
  -import org.apache.commons.resources.ResourcesFactory;
  -import org.apache.commons.resources.impl.ResourceBundleResourcesFactory;
   
  +import org.apache.commons.resources.impl.ResourceBundleResourcesFactory;
   
   /**
    * <p>Wrapper around any {@link Resources} object that performs message
  @@ -89,7 +85,6 @@
    * @author Craig R. McClanahan
    * @version $Revision$ $Date$
    */
  -
   public class Messages implements Serializable {
   
   
  @@ -114,12 +109,6 @@
   
   
       /**
  -     * <p>The default <code>Locale</code> for this JVM.</p>
  -     */
  -    protected Locale defaultLocale = null;
  -
  -
  -    /**
        * <p>The {@link Resources} instance that we are wrapping.</p>
        */
       protected Resources resources = null;
  @@ -175,11 +164,9 @@
        * @param key Message key to retrieve
        * @param args Array of replacement values
        */
  -    public String getMessage(String key, Object args[]) {
  -
  -        return (getMessage(resources, key, args));
  -
  -    }
  +	public String getMessage(String key, Object[] args) {
  +		return getMessage(resources, key, args);
  +	}
   
   
       /**
  @@ -190,11 +177,9 @@
        * @param key Message key to retrieve
        * @param args Array of replacement values
        */
  -    public String getMessage(Locale locale, String key, Object args[]) {
  -
  -        return (getMessage(resources, locale, key, args));
  -
  -    }
  +	public String getMessage(Locale locale, String key, Object[] args) {
  +		return getMessage(resources, locale, key, args);
  +	}
   
   
       /**
  @@ -390,12 +375,13 @@
        * @param key Message key to retrieve
        * @param args Array of replacement values
        */
  -    public static String getMessage(Resources resources, String key,
  -                                    Object args[]) {
  +	public static String getMessage(
  +		Resources resources,
  +		String key,
  +		Object[] args) {
   
  -        return (getMessage(resources, (Locale) null, key, args));
  -
  -    }
  +		return getMessage(resources, (Locale) null, key, args);
  +	}
   
   
       /**
  @@ -407,15 +393,18 @@
        * @param key Message key to retrieve
        * @param args Array of replacement values
        */
  -    public static String getMessage(Resources resources, Locale locale,
  -                                    String key, Object args[]) {
  +	public static String getMessage(
  +		Resources resources,
  +		Locale locale,
  +		String key,
  +		Object[] args) {
  +
  +		// FIXME - Cache MessageFormat instances?
  +		String message = getMessage(resources, locale, key);
  +		MessageFormat format = new MessageFormat(message);
  +		return (format.format(args));
   
  -        // FIXME - Cache MessageFormat instances?
  -        String message = getMessage(resources, locale, key);
  -	MessageFormat format = new MessageFormat(message);
  -        return (format.format(args));
  -
  -    }
  +	}
   
   
       /**
  
  
  

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