public class SimpleTextProvider extends Object implements TextProvider
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_MESSAGE_RESOURCE |
protected Locale |
locale |
protected String |
messageResource |
protected ResourceBundle |
resourceBundle |
copyright| Modifier and Type | Method and Description |
|---|---|
static SimpleTextProvider |
create() |
static SimpleTextProvider |
create(Locale locale) |
static SimpleTextProvider |
create(Locale locale,
String messageResource) |
static SimpleTextProvider |
create(String messageResource) |
String |
getLocalizedString(String key) |
String |
getText(String key,
Object... args)
Get the localized string according to the key, and replace any placeholders with the arguments.
|
String |
getTextOrNull(String key,
Object... args)
Same as
getText, but returns null if the key has no associated
string in the given locale. |
public static final String DEFAULT_MESSAGE_RESOURCE
protected final Locale locale
protected final String messageResource
protected final ResourceBundle resourceBundle
public static SimpleTextProvider create()
public static SimpleTextProvider create(Locale locale)
public static SimpleTextProvider create(String messageResource)
public static SimpleTextProvider create(Locale locale, String messageResource)
public String getText(String key, Object... args)
TextProvidergetText in interface TextProviderkey - the key in the resource bundle.args - arguments to insert where the string contains placeholders.public String getTextOrNull(String key, Object... args)
TextProvidergetText, but returns null if the key has no associated
string in the given locale.getTextOrNull in interface TextProviderkey - the key in the resource bundle.args - arguments to insert where the string contains placeholders.Copyright © 2022 MANYDESIGNS s.r.l.. All rights reserved.