annotate content/Java/localized-resource-bundle-subclasses.md @ 48:ef688010ddb5

fix the image ALT tag
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 28 Oct 2014 16:42:36 +0100
parents 4cd9b65e10e4
children 3f6c9b512b85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1 Title: Localized ResourceBundle subclasses
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 Date: 2007-05-14
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 Tags: JDK
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4 lang: en
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 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.