KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > Messages


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      * Returns true if the given key is associated with a message, false otherwise.
28      *
29      * @since 1.2
30      */

31     boolean containsMessage(String JavaDoc key);
32
33     /**
34      * Searches for a localized string with the given key. If not found, a modified version of the
35      * key is returned (all upper-case and surrounded by square brackets).
36      */

37
38     String JavaDoc getMessage(String JavaDoc key);
39
40     /**
41      * Formats a string, using
42      * {@link java.text.MessageFormat#format(java.lang.String, java.lang.Object[])}.
43      *
44      * @param key
45      * the key used to obtain a localized pattern using {@link #getMessage(String)}
46      * @param arguments
47      * passed to the formatter
48      */

49
50     String JavaDoc format(String JavaDoc key, Object JavaDoc[] arguments);
51
52     /**
53      * Convienience method for invoking {@link #format(String, Object[])}.
54      */

55     String JavaDoc format(String JavaDoc key, Object JavaDoc argument);
56
57     /**
58      * Convienience method for invoking {@link #format(String, Object[])}.
59      */

60
61     String JavaDoc format(String JavaDoc key, Object JavaDoc argument1, Object JavaDoc argument2);
62
63     /**
64      * Convienience method for invoking {@link #format(String, Object[])}.
65      */

66     String JavaDoc format(String JavaDoc key, Object JavaDoc argument1, Object JavaDoc argument2, Object JavaDoc argument3);
67 }
Popular Tags