Mercurial > hg > Blog
view content/Java/localized-resource-bundle-subclasses.md @ 36:96084c11584a
comment out the captcha code. Trying the new approach to accept any blog post comment and
filter it through an email spam filter.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 01 Sep 2014 04:16:11 +0200 |
parents | 4cd9b65e10e4 |
children | 3f6c9b512b85 |
line wrap: on
line source
Title: Localized ResourceBundle subclasses Date: 2007-05-14 Tags: JDK lang: en When working on Mule's i18n support I stubled over a hidden gem in java. The ResourceBundle's `getResourceBundle` method will build a candidate name and look for a class **with this name** in the runtime before resorting to loading properties files. I'd like to play around with this feature a bit, currently I'm thinking of using plain java classes as storage for error messages. With proper class hierarchies the need to duplicate each and every message should be gone then, as the wonder of overridden methods kicks in. See [ResourceBundle's getBundle method description](http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)) for detailed documentation.