[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-9356) NLS.bind vs MessageFormat.format

Max Rydahl Andersen (JIRA) jira-events at lists.jboss.org
Mon Jul 18 08:55:24 EDT 2011


    [ https://issues.jboss.org/browse/JBIDE-9356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614774#comment-12614774 ] 

Max Rydahl Andersen commented on JBIDE-9356:
--------------------------------------------

They aren't blindly interchangeable.

NLS.bind is the fastest and requires the least memory of the two and should use for any trivial lookup and when just need to bind raw strings into the format.

MessageFormat.format handles localization of numbers, date's etc. and should thus be used if localized date format and number format is required.

Since we normally don't have that then in most cases NLS.bind is the winner, and only in the (probably very) few cases of fully localized is needed MessageFormat should be used.

I'm keeping the issue open to take a further look to see if its being used very wrong.



> NLS.bind vs MessageFormat.format
> --------------------------------
>
>                 Key: JBIDE-9356
>                 URL: https://issues.jboss.org/browse/JBIDE-9356
>             Project: Tools (JBoss Tools)
>          Issue Type: Task
>          Components: Cleanup
>    Affects Versions: 3.3.0.M3
>            Reporter: Rob Stryker
>            Assignee: Max Rydahl Andersen
>             Fix For: 3.3.0.Final
>
>
> A substantial number of classes use NLS.bind(Messages.SomeString, name) to bind message strings. Another subset of the classes use MessageFormat.format(etc).  
> I believe NLS.bind() is the correct solution which works properly with eclipse osgi and all that jazz. Should this be standardized? Is it confusing to be using two interchangable APIs? 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list