1 /* 2 * Copyright (c) 2009 QOS.ch All rights reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to deal 6 * in the Software without restriction, including without limitation the rights 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 * copies of the Software, and to permit persons to whom the Software is 9 * furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 * SOFTWARE. 21 */ 22 23 package ch.qos.cal10n; 24 25 import java.text.MessageFormat; 26 27 // note that the getMessage method does not take a Locale. 28 // It is supposed that the MessageConveyor instance knows 29 // which locale to use. 30 31 /** 32 * Retrieve a message by its code as specified by an enum. 33 * 34 * <p> 35 * The strategy in retrieving messages may vary from implementation to 36 * implementation. 37 * 38 * @author Ceki Gülcü 39 */ 40 public interface IMessageConveyor { 41 42 /** 43 * Retrieve a message by its code as specified by an enum. 44 * 45 * <p> 46 * Note that any further arguments passed in 'args' will be interpolated using 47 * the translated message. The interpolation will be done according to 48 * conventions of {@link MessageFormat}. 49 * 50 * @param <E> 51 * an enum type 52 * @param e 53 * an enum instance 54 * @param args 55 * optional arguments 56 * @return 57 * 58 * @param <E> 59 * @param e 60 * @param args 61 * @return 62 */ 63 <E extends Enum<?>> String getMessage(E e, Object... args); 64 }