01: // Copyright 2004, 2005 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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: * Searches for a localized string with the given key. If not found, a modified version of the
27: * key is returned (all upper-case and surrounded by square brackets).
28: */
29:
30: public String getMessage(String key);
31:
32: /**
33: * Formats a string, using
34: * {@link java.text.MessageFormat#format(java.lang.String, java.lang.Object[])}.
35: *
36: * @param key
37: * the key used to obtain a localized pattern using {@link #getMessage(String)}
38: * @param arguments
39: * passed to the formatter
40: */
41:
42: public String format(String key, Object[] arguments);
43:
44: /**
45: * Convienience method for invoking {@link #format(String, Object[])}.
46: */
47: public String format(String key, Object argument);
48:
49: /**
50: * Convienience method for invoking {@link #format(String, Object[])}.
51: */
52:
53: public String format(String key, Object argument1, Object argument2);
54:
55: /**
56: * Convienience method for invoking {@link #format(String, Object[])}.
57: */
58: public String format(String key, Object argument1,
59: Object argument2, Object argument3);
60: }
|