commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37711] New: - [resources] Messages Refactoring
Date Wed, 30 Nov 2005 10:56:21 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37711>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37711

           Summary: [resources] Messages Refactoring
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: Resources
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: niallp@apache.org


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, "foo.bar", Messages.args
("first", "second"));

5) Provide methods to set the default Locale, if not supplied in the getMessage
() methods.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
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