Source code: org/apache/hivemind/Messages.java
1 // Copyright 2004, 2005 The Apache Software Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package org.apache.hivemind;
16
17 /**
18 * A set of localized message strings. This is somewhat like a {@link java.util.ResourceBundle},
19 * but with more flexibility about where the messages come from. In addition, it includes methods
20 * similar to {@link java.text.MessageFormat} for treating the messages as patterns.
21 *
22 * @author Howard Lewis Ship
23 */
24 public interface Messages
25 {
26 /**
27 * Searches for a localized string with the given key. If not found, a modified version of the
28 * key is returned (all upper-case and surrounded by square brackets).
29 */
30
31 public String getMessage(String key);
32
33 /**
34 * Formats a string, using
35 * {@link java.text.MessageFormat#format(java.lang.String, java.lang.Object[])}.
36 *
37 * @param key
38 * the key used to obtain a localized pattern using {@link #getMessage(String)}
39 * @param arguments
40 * passed to the formatter
41 */
42
43 public String format(String key, Object[] arguments);
44
45 /**
46 * Convienience method for invoking {@link #format(String, Object[])}.
47 */
48 public String format(String key, Object argument);
49
50 /**
51 * Convienience method for invoking {@link #format(String, Object[])}.
52 */
53
54 public String format(String key, Object argument1, Object argument2);
55
56 /**
57 * Convienience method for invoking {@link #format(String, Object[])}.
58 */
59 public String format(String key, Object argument1, Object argument2, Object argument3);
60 }