blob: 97954c1d7b23a91a922e7a8973653127b08bac67 [file] [log] [blame]
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<html>
<body>
<p>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. <code>bundle.getMessage("filenotfound")</code>)
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.
</p>
<p>
To use the package the programmer defines an interface that extends <code>org.apache.ode.utils.msg.MsgBundle</code>
with methods for each required message. Each method name must start with the strings "msg" or
"str", and have a <code>@jlo.msg</code> JavaDoc tag containing the default message text (internationalized
versions can be placed in corresponding property files). For example:
<pre>
<code>
interface MyMsgs extends org.apache.ode.utils.msg.MsgBundle {
/**
* @jlo.msg File '{0}' not found.
*/
String msgFileNotFound(String fname);
}
</code>
</pre>
creates a bundle with one <em>FileNotFound</em> message. To use the bundle, one writes:
<pre>
<code>
MyMsgs msgs = (MyMsgs) BundleManager.getBundle(MyMsgs.class);
msgs.msgFileNotFound("foo.zip");
</code>
</pre>
Calling the <code>msgFileNotFound</code> method returns the formatted message string, as generated by the
<code>java.util.text.MessageBundle</code> class (with method arguments passed as arguments to the
<code>format</code> method).
</p>
</body>
</html>