java.lang.Object
com.aoapps.lang.text.MessageFormatFactory
Creates MessageFormat objects and caches them. This may be used as an alternative
to the MessageFormat constructor to increase performance.
The following are the results of a single-threaded benchmark with a simple two-value substitution:
Comparing constructor/factory and format together: Constructor: 1148.127153 Factory....: 283.366235 4 times improvement Comparing constructor/factory only: Constructor: 985.182660 Factory....: 42.602040 23 times improvement
Longer or more complicated patterns should benefit even more (this assertion not tested).
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic UnmodifiableMessageFormat
getMessageFormat
(String pattern) Gets a message format for the provided format in the current thread locale.static UnmodifiableMessageFormat
getMessageFormat
(String pattern, Locale locale) Gets a message format for the provided format and locale.
-
Method Details
-
getMessageFormat
Gets a message format for the provided format in the current thread locale.- Returns:
- a MessageFormat that may not be modified with any of its setters or other mutator methods.
- See Also:
-
getMessageFormat
Gets a message format for the provided format and locale.- Returns:
- a MessageFormat that may not be modified with any of its setters or other mutator methods.
-