KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > uitags > tagutil > i18n > I18nIgnorantMessageFinder


1 /**
2  * Nov 22, 2004
3  *
4  * Copyright 2004 uitags
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package net.sf.uitags.tagutil.i18n;
19
20 import javax.servlet.jsp.PageContext JavaDoc;
21
22 import net.sf.uitags.util.UiString;
23
24 /**
25  * A message finder with no I18N support. It does not perform message
26  * look up; it simply returns whatever string is given to it.
27  *
28  * @author jonni
29  * @version $Id$
30  */

31 public final class I18nIgnorantMessageFinder implements MessageFinder {
32   private static final long serialVersionUID = 100L;
33
34   /**
35    * Default constructor.
36    */

37   public I18nIgnorantMessageFinder() {
38     super();
39   }
40
41   /** {@inheritDoc} */
42   public void setPageContext(PageContext JavaDoc pageContext) {
43     // Do nothing
44
}
45
46   /** {@inheritDoc} */
47   public String JavaDoc get(String JavaDoc key) {
48     return key;
49   }
50
51   /** {@inheritDoc} */
52   public String JavaDoc get(String JavaDoc key, Object JavaDoc arg0) {
53     return UiString.simpleConstruct(key, new String JavaDoc[] { String.valueOf(arg0) });
54   }
55
56   /** {@inheritDoc} */
57   public String JavaDoc get(String JavaDoc key, Object JavaDoc[] args) {
58     String JavaDoc[] params = new String JavaDoc[args.length];
59     for (int i = 0; i < args.length; i++) {
60       params[i] = String.valueOf(args[i]);
61     }
62     return UiString.simpleConstruct(key, params);
63   }
64 }
65
Popular Tags