0 Replies Latest reply on Oct 9, 2001 9:08 AM by Ignacio

    How to link two ResourceBundles via parent property

    Ignacio Newbie

      I have two ResourceBundles that I would like to link (better than trying to re-invent the wheel via any pattern such as facade).

      The point is, I have a "general" ResourceBundle with the general error messages of my architecture (such as "parameter not found", and "out of bounds") and another "particular" one for the concrete application .war (such as "customer not available", or whatever).

      I can keep both separate, but am thinking about linking both (via the parent property), but at the same time keep the properties files (I don't like very much the idea of having to implement a ResourceBundle subclass for every Locale).

      The setParent method is protected and that forces me to implemet child classes, but I got lost in the API. This far I am mostly convinced that doing this is impossible without reimplementing the ResourceBundle class.

      An example of what I am trying to do:

      mymessage1 = Parameter not found

      mymessage2 = Customer not available

      ResourceBundle rb = ResourceBundle.get("com.client.resources", new Locale("en"));

      Properly implemented, that code would return "Parameter not found"