org.mmbase.util
Class ReplacingLocalizedString
java.lang.Object
org.mmbase.util.LocalizedString
org.mmbase.util.WrappedLocalizedString
org.mmbase.util.ReplacingLocalizedString
- All Implemented Interfaces:
- Serializable, Cloneable, PublicCloneable<LocalizedString>
public class ReplacingLocalizedString
- extends WrappedLocalizedString
Extends and wraps LocalizedString. It extends to look like a 'normal' LocalizedString, but it
overrides 'get' to do token-replacements first.
This functionality is not in LocalizedString itself, because now you can have different
replacements on the same value set represented by a LocalizedString withouth having to copy
everything every time.
- Since:
- MMBase-1.8
- Version:
- $Id: ReplacingLocalizedString.java,v 1.7 2008/08/27 17:07:34 michiel Exp $
- Author:
- Michiel Meeuwissen
- See Also:
- Serialized Form
| Methods inherited from class org.mmbase.util.LocalizedString |
degrade, equals, fillFromXml, getDefault, getLocale, getLocale, getXmlLang, hashCode, setDefault, setXmlLang, toString, toStrings, toXml |
ReplacingLocalizedString
protected ReplacingLocalizedString()
ReplacingLocalizedString
public ReplacingLocalizedString(LocalizedString s)
- Parameters:
s - The wrapped LocalizedString.
replaceAll
public void replaceAll(String regexp,
String replacement)
replace
protected String replace(String input)
get
public String get(Locale locale)
- Description copied from class:
LocalizedString
- Gets the value for a certain locale. If no match is found, it falls back to the key.
- Overrides:
get in class WrappedLocalizedString
asMap
public Map<Locale,String> asMap()
- Returns a Map representation of the localisation setting represented by this
LocalizedString. It is an unmodifiable mapping: Locale -> localized value.
Also takes into account the replacements in the values (but only 'lazily', when actually requested).
- Overrides:
asMap in class LocalizedString
clone
public ReplacingLocalizedString clone()
- Specified by:
clone in interface PublicCloneable<LocalizedString>- Overrides:
clone in class LocalizedString
makeLiteral
public static String makeLiteral(String s)
- Utility method for second argument of replaceAll
main
public static void main(String[] argv)
MMBase build 1.9.0.20081107