Package se.litsec.opensaml.utils.spring
Class StringToLocalizedStringConverter
- java.lang.Object
-
- se.litsec.opensaml.utils.spring.StringToLocalizedStringConverter
-
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<String,LocalizedString>
public class StringToLocalizedStringConverter extends Object implements org.springframework.core.convert.converter.Converter<String,LocalizedString>
Utility class for transforming strings into OpenSAML LocalizedStrings.The strings being converted MUST start with the language identifier followed by a hyphen. For example, the string "en-Hello" will be translated to the localized string "Hello" in English. If no language indicator is given, a
LocalizedStringwith no language tag will be created.- Author:
- Martin Lindström (martin.lindstrom@litsec.se)
-
-
Constructor Summary
Constructors Constructor Description StringToLocalizedStringConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalizedStringconvert(String source)Converts strings on the format<lang-tag>-<string according to language>.
-
-
-
Method Detail
-
convert
public LocalizedString convert(String source)
Converts strings on the format<lang-tag>-<string according to language>. The string "en-Hello" will give a LocalizedString where:ls.getLanguage() => "en" ls.getLocalString() => "Hello"- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<String,LocalizedString>
-
-