Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MessageProvider |
|
| 1.0;1 |
1 | /* | |
2 | * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons-sandbox//i18n/src/java/org/apache/commons/i18n/MessageProvider.java,v 1.2 2004/12/29 17:03:55 dflorey Exp $ | |
3 | * $Revision: 480489 $ | |
4 | * $Date: 2006-11-29 09:00:46 +0000 (Wed, 29 Nov 2006) $ | |
5 | * | |
6 | * ==================================================================== | |
7 | * | |
8 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
9 | * contributor license agreements. See the NOTICE file distributed with | |
10 | * this work for additional information regarding copyright ownership. | |
11 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
12 | * (the "License"); you may not use this file except in compliance with | |
13 | * the License. You may obtain a copy of the License at | |
14 | * | |
15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
16 | * | |
17 | * Unless required by applicable law or agreed to in writing, software | |
18 | * distributed under the License is distributed on an "AS IS" BASIS, | |
19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
20 | * See the License for the specific language governing permissions and | |
21 | * limitations under the License. | |
22 | * | |
23 | */ | |
24 | package org.apache.commons.i18n; | |
25 | ||
26 | import java.util.Locale; | |
27 | import java.util.Map; | |
28 | ||
29 | /** | |
30 | * The <code>MessageProvider</code> interface specifies the methods that | |
31 | * must be implemented by each message provider in order to be pluggable | |
32 | * into the <code>MessageManager</code>. | |
33 | * | |
34 | */ | |
35 | public interface MessageProvider { | |
36 | /** | |
37 | * @param id unique id that specifies a particular message | |
38 | * @param entry specifies a particular entry in the specified message | |
39 | * @param locale the locale for which this text should be provided | |
40 | * @return returns the localized message entry matching the given message id, entry key and locale. If | |
41 | * no match is found for the given locale, the parent locale is used, and finally the default. If the | |
42 | * id is found but the entry is not, null is returned. | |
43 | * @throws MessageNotFoundException thrown if no message exists matching the given id | |
44 | */ | |
45 | public String getText(String id, String entry, Locale locale); | |
46 | ||
47 | /** | |
48 | * @param id unique id that specifies a particular message | |
49 | * @param locale the locale for which to return the entries | |
50 | * @return returns a map <code><entry(String) -> localized text(String)<code> of | |
51 | * message entries matching the given message id and locale | |
52 | * @throws MessageNotFoundException thrown if no message could be found matching the given message id | |
53 | */ | |
54 | public Map getEntries(String id, Locale locale) throws MessageNotFoundException; | |
55 | } |