001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.hivemind;
016    
017    /**
018     * A set of localized message strings. This is somewhat like a {@link java.util.ResourceBundle},
019     * but with more flexibility about where the messages come from. In addition, it includes methods
020     * similar to {@link java.text.MessageFormat} for treating the messages as patterns.
021     * 
022     * @author Howard Lewis Ship
023     */
024    public interface Messages
025    {
026        /**
027         * Searches for a localized string with the given key. If not found, a modified version of the
028         * key is returned (all upper-case and surrounded by square brackets).
029         */
030    
031        public String getMessage(String key);
032    
033        /**
034         * Formats a string, using
035         * {@link java.text.MessageFormat#format(java.lang.String, java.lang.Object[])}.
036         * 
037         * @param key
038         *            the key used to obtain a localized pattern using {@link #getMessage(String)}
039         * @param arguments
040         *            passed to the formatter
041         */
042    
043        public String format(String key, Object[] arguments);
044    
045        /**
046         * Convienience method for invoking {@link #format(String, Object[])}.
047         */
048        public String format(String key, Object argument);
049    
050        /**
051         * Convienience method for invoking {@link #format(String, Object[])}.
052         */
053    
054        public String format(String key, Object argument1, Object argument2);
055    
056        /**
057         * Convienience method for invoking {@link #format(String, Object[])}.
058         */
059        public String format(String key, Object argument1, Object argument2, Object argument3);
060    }