view content/Java/localized-resource-bundle-subclasses.md @ 90:e19bc3042ec9

draft for formatting eclipse sources using a batch tool Proper blog post for chromecasting
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 23 Jan 2018 08:15:01 +0100
parents 3f6c9b512b85
children
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](https://docs.oracle.com/javase/7/docs/api/java/util/ResourceBundle.html#getBundle%28java.lang.String,%20java.util.Locale,%20java.lang.ClassLoader%29) for detailed documentation.