All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.ode.utils.msg.package.html Maven / Gradle / Ivy

There is a newer version: 1.3.8
Show newest version




This package provies "refactorable" internationalized message bundles. The goal is to provide a consistent framework for obtaining internationalized error and informational messaeges, with the additional requirement that it should be easy to "refactor" the names of the message keys. Instead of relying on clients to pass string message keys (e.g. bundle.getMessage("filenotfound")) this package requires the programmer to create a method decleration for each message. The programmer does not however need to provide an implementation of the method, which is generated automatically by the package.

To use the package the programmer defines an interface that extends org.apache.ode.utils.msg.MsgBundle with methods for each required message. Each method name must start with the strings "msg" or "str", and have a @jlo.msg JavaDoc tag containing the default message text (internationalized versions can be placed in corresponding property files). For example:


interface MyMsgs extends org.apache.ode.utils.msg.MsgBundle {

  /**
   * @jlo.msg File '{0}' not found.
   */
  String msgFileNotFound(String fname);
}


creates a bundle with one FileNotFound message. To use the bundle, one writes:

MyMsgs msgs = (MyMsgs) BundleManager.getBundle(MyMsgs.class);
msgs.msgFileNotFound("foo.zip");

Calling the msgFileNotFound method returns the formatted message string, as generated by the java.util.text.MessageBundle class (with method arguments passed as arguments to the format method).





© 2015 - 2025 Weber Informatics LLC | Privacy Policy