Interface StringBundle
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
String bundle contains locale-specific strings.
It can be viewed a specialized variant of
ResourceBundle
.
Use fromResourceBundle(ResourceBundle)
to obtain StringBundle
instance from ResourceBundle
object.
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Gets a formatted message built from the pattern string matching the given key in this string bundle and the given arguments.static StringBundle
fromResourceBundle
(ResourceBundle bundle) GetsStringBundle
instance from the givenResourceBundle
object.Gets a string for the given key from this string bundle.
-
Method Details
-
getString
-
format
Gets a formatted message built from the pattern string matching the given key in this string bundle and the given arguments.If non-empty list of arguments provided the function calls
MessageFormat.format(String, Object...)
. Otherwise, it returns the result ofgetString(String)
method call.- Parameters:
key
- the key for the desired patternargs
- the array of arguments for formatting or an empty array for no formatting- Returns:
- the formatted message
-
fromResourceBundle
GetsStringBundle
instance from the givenResourceBundle
object.- Parameters:
bundle
- the resource bundle- Returns:
- the string bundle
-