commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Meikle (JIRA)" <>
Subject [jira] Resolved: (RESOURCES-17) [resources] Messages Refactoring
Date Tue, 02 Jun 2009 21:51:07 GMT


Dave Meikle resolved RESOURCES-17.

       Resolution: Fixed
    Fix Version/s: 1.0

Thought I would take the suck it and see approach. Re-open the ticket if there are any issues
with this.

> [resources] Messages Refactoring
> --------------------------------
>                 Key: RESOURCES-17
>                 URL:
>             Project: Commons Resources
>          Issue Type: Bug
>         Environment: Operating System: All
> Platform: All
>            Reporter: Niall Pemberton
>            Assignee: Dave Meikle
>            Priority: Critical
>             Fix For: 1.0
>         Attachments: RESOURCES-17.diff
> I'm proposing the Messages's API change to the following:
>   public void setDefaultLocale(Locale locale)
>   public Locale getDefaultLocale()
>   public String getMessage(String key)
>   public String getMessage(String key, Object[] args)
>   public String getMessage(String key, Locale locale) 
>   public String getMessage(String key, String key, Object[] args, Locale locale)
>   public static Resources getMessages(ResourcesFactory factory, String name)
>   public static Object[] args(Object arg0)
>   public static Object[] args(Object arg0, Object arg1)
>   public static Object[] args(Object arg0, Object arg1, Object arg2)
>   public static Object[] args(Object arg0, Object arg1, Object arg2, Object 
> arg3)
> ...for the following reasoning:
> 1) Remove the static getMessage() methods from the Messages object. The problem 
> is that currently the instance methods all call one of the static methods to do 
> the MessageFormat processing making this class difficult to create custom 
> implementations for.
> 2) Change the getMessage() parameter order to key, args, locale (as per Bug 
> 37702)
> 3) Remove the static setFactory method and change the static getMessages method 
> to include a Factory parameter - that way there would be no conflict with 
> different parts of an application having to set a static instance variable 
> before calling getMessages().
> 4) Only have one instance method that has an Object[] for arguments, but add 
> static convenience methods for turning arguments into an Object[].  Users could 
> then do something like the following:
>  String msg = messages.getMessage(locale, "", Messages.args
> ("first", "second"));
> 5) Provide methods to set the default Locale, if not supplied in the getMessage
> () methods.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message