01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.util;
11:
12: import java.util.*;
13: import org.mmbase.util.logging.*;
14:
15: /**
16: * Extends and wraps LocalizedString.
17: *
18: * @author Michiel Meeuwissen
19: * @version $Id: WrappedLocalizedString.java,v 1.1 2006/11/11 12:56:39 michiel Exp $
20: * @since MMBase-1.9
21: */
22: public class WrappedLocalizedString extends LocalizedString {
23:
24: private static final Logger log = Logging
25: .getLoggerInstance(WrappedLocalizedString.class);
26:
27: protected LocalizedString wrapped;
28: private Locale defaultLocale = null;
29:
30: // just for the contract of Serializable
31: protected WrappedLocalizedString() {
32:
33: }
34:
35: /**
36: * @param s The wrapped LocalizedString.
37: */
38: public WrappedLocalizedString(LocalizedString s) {
39: if (s == null)
40: s = new LocalizedString("NULL");
41: wrapped = s;
42: }
43:
44: public Locale setLocale(Locale loc) {
45: Locale prev = defaultLocale;
46: defaultLocale = loc;
47: return prev;
48: }
49:
50: //javadoc inherited
51: public String getKey() {
52: return wrapped.getKey();
53: }
54:
55: //javadoc inherited
56: public void setKey(String key) {
57: wrapped.setKey(key);
58: }
59:
60: // javadoc inherited
61: public String get(Locale locale) {
62: if (locale == null)
63: locale = defaultLocale;
64: return wrapped.get(locale);
65: }
66:
67: //javadoc inherited
68: public void set(String value, Locale locale) {
69: wrapped.set(value, locale);
70: }
71:
72: // javadoc inherited
73: public void setBundle(String b) {
74: wrapped.setBundle(b);
75: }
76:
77: }
|