public class LocalizedTextSetImpl extends Object implements LocalizedTextSet
LocalizedTextSet is a collection of LocalizedText instances scoped to a particular group. It is a special structure to be used for:
A LocalizedTextSet is hooked to a LocalizedTextService that should provide the actual implementation of the LocalizedText backend. Things like creating default values, saving in database, etc.
| Modifier | Constructor and Description |
|---|---|
protected |
LocalizedTextSetImpl(String application,
String group,
LocalizedTextService localizedTextService)
Constructs a new LocalizedTextSet based on a collection of items.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
exists(String label) |
String |
getApplication() |
String |
getGroup() |
Collection<LocalizedText> |
getItems() |
String |
getText(String label,
Language language)
Returns the value for a specific language of a text item.
|
String |
getText(String label,
Language language,
String defaultValue)
Returns the value for a specific language of a text item.
|
String |
getText(String label,
Language language,
String defaultValue,
boolean storeDefault)
Returns the value for a specific language of a text item.
|
void |
reload()
Reloads all items in this set from the backing data store.
|
int |
size() |
protected LocalizedTextSetImpl(String application, String group, LocalizedTextService localizedTextService)
Constructs a new LocalizedTextSet based on a collection of items. The collection may contain duplicates but in case of multiples the item with the highest index in the collection will be retained.
application - Name of the application that new items in this set should be created in.group - Name of the group that new items in this set should be created in.localizedTextService - Service owning this set, where callbacks will occur based on set modifications.public final String getApplication()
getApplication in interface LocalizedTextSetpublic final String getGroup()
getGroup in interface LocalizedTextSetpublic final Collection<LocalizedText> getItems()
getItems in interface LocalizedTextSetpublic final String getText(String label, Language language)
LocalizedText), this method will trigger a
flagAsUsed call on the LocalizedTextService provided.getText in interface LocalizedTextSetlabel - Label of the text item.language - Language for which we want the value.public final String getText(String label, Language language, String defaultValue)
LocalizedText), this method will trigger a
flagAsUsed call on the LocalizedTextService provided.getText in interface LocalizedTextSetlabel - Label of the text item.language - Language for which we want the value.defaultValue - Value to return in case the text item does not yet exist.public String getText(String label, Language language, String defaultValue, boolean storeDefault)
LocalizedText), this method will trigger a
flagAsUsed call on the LocalizedTextService provided.getText in interface LocalizedTextSetlabel - Label of the text item.language - Language for which we want the value.defaultValue - Value to return in case the text item does not yet exist.storeDefault - Whether the default value should be stored when not found.public final boolean exists(String label)
exists in interface LocalizedTextSetlabel - Label of the item to search for.public final int size()
size in interface LocalizedTextSetpublic final void reload()
reload in interface LocalizedTextSetCopyright © 2017. All rights reserved.