@ThreadSafe public class MultiLingualTextThreadSafe extends Object implements IMultiLingualText
| Modifier and Type | Field and Description |
|---|---|
protected ReadWriteLock |
m_aRWLock |
| Constructor and Description |
|---|
MultiLingualTextThreadSafe() |
MultiLingualTextThreadSafe(IReadonlyMultiLingualText aMLT) |
MultiLingualTextThreadSafe(ISimpleMultiLingualText aSimpleMLT)
Constructor especially for the static TextProvider.createXXX methods
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeNotifier(IChangeNotify<IMultiLingualText> aCallback)
Add a notification callback that is called, when the object is changed.
|
EChange |
addText(Locale aContentLocale,
String sText)
Add a text in the specified locale.
|
EChange |
assignFrom(IReadonlyMultiLingualText aMLT)
Assign all fields from the passed object.
|
EChange |
clear()
Reset the contents of the element to the after-construction state.
|
boolean |
containsLocale(Locale aContentLocale)
Check if the passed locale is directly contained.
|
boolean |
containsLocaleWithFallback(Locale aContentLocale)
Check if the passed locale is directly or by fallback contained.
|
static IMultiLingualText |
createFromMap(Map<String,String> aMap) |
boolean |
equals(Object o) |
Set<Locale> |
getAllLocales() |
int |
getLocaleCount() |
Map<Locale,String> |
getMap() |
String |
getText(Locale aContentLocale)
Get the text specific for the passed locale.
|
String |
getTextWithArgs(Locale aContentLocale,
Object... aArgs)
Get the text specific for the passed locale.
|
String |
getTextWithLocaleFallback(Locale aContentLocale)
Get the text specific for the passed locale.
|
String |
getTextWithLocaleFallbackAndArgs(Locale aContentLocale,
Object... aArgs)
Get the text specific for the passed locale.
|
int |
hashCode() |
boolean |
isEmpty() |
EChange |
removeText(Locale aContentLocale)
Remove the text with the specified locale.
|
EChange |
setText(Locale aContentLocale,
String sText)
Set a text in the specified locale.
|
int |
size() |
String |
toString() |
protected final ReadWriteLock m_aRWLock
public MultiLingualTextThreadSafe()
public MultiLingualTextThreadSafe(@Nonnull ISimpleMultiLingualText aSimpleMLT)
aSimpleMLT - The simple multi lingual text to use.public MultiLingualTextThreadSafe(@Nonnull IReadonlyMultiLingualText aMLT)
@Nullable public String getText(@Nonnull Locale aContentLocale)
ISimpleTextProvidergetText in interface ISimpleTextProvideraContentLocale - The locale to use. May not be null.null if no text for the given locale was found.@Nullable public String getTextWithLocaleFallback(@Nonnull Locale aContentLocale)
ISimpleTextProvidergetTextWithLocaleFallback in interface ISimpleTextProvideraContentLocale - The locale to use. May not be null.null if no text for the given locale was found.LocaleUtils.getCalculatedLocaleListForResolving(Locale)@Nullable public String getTextWithArgs(@Nonnull Locale aContentLocale, @Nullable Object... aArgs)
ITextProviderFormat.format(Object) method.getTextWithArgs in interface ITextProvideraContentLocale - The locale to use. May not be null.aArgs - The arguments to be added into the string. May be null
but this makes no sense.null if no text for the given locale was found.@Nullable public String getTextWithLocaleFallbackAndArgs(@Nonnull Locale aContentLocale, @Nullable Object... aArgs)
ITextProviderFormat.format(Object) method.getTextWithLocaleFallbackAndArgs in interface ITextProvideraContentLocale - The locale to use. May not be null.aArgs - The arguments to be added into the string. May be null
but this makes no sense.null if no text for the given locale was found.LocaleUtils.getCalculatedLocaleListForResolving(Locale)@Nonnull public EChange addText(@Nonnull Locale aContentLocale, @Nullable String sText)
IMultiLingualTextfalse is returned.addText in interface IMultiLingualTextaContentLocale - The locale in which the text should be set. May not be
null.sText - The text to be set. May be null.EChange.CHANGED if the text was added,
EChange.UNCHANGED otherwise.@Nonnull public EChange setText(@Nonnull Locale aContentLocale, @Nullable String sText)
IMultiLingualTextsetText in interface IMultiLingualTextaContentLocale - The locale in which the text should be set. May not be
null .sText - The text to be set. May be null.EChange.CHANGED if the text was set,
EChange.UNCHANGED otherwise.@Nonnegative public int getLocaleCount()
getLocaleCount in interface IHasLocalespublic boolean containsLocale(@Nullable Locale aContentLocale)
IHasLocalescontainsLocale in interface IHasLocalesaContentLocale - The locale to check. May be null.true if the locale is directly contained,
false if not.public boolean containsLocaleWithFallback(@Nullable Locale aContentLocale)
IHasLocalescontainsLocaleWithFallback in interface IHasLocalesaContentLocale - The locale to check. May be null.true if the locale is contained, false if
not.@Nonnull @ReturnsMutableCopy public Map<Locale,String> getMap()
getMap in interface IReadonlyMultiLingualTextnull
.@Nonnegative public int size()
public boolean isEmpty()
isEmpty in interface IHasSizetrue if no items are present, false if at
least a single item is present.IHasSize.size()@Nonnull @ReturnsMutableCopy public Set<Locale> getAllLocales()
getAllLocales in interface IHasLocalesnull.@Nonnull public EChange removeText(@Nonnull Locale aContentLocale)
IMultiLingualTextremoveText in interface IMultiLingualTextaContentLocale - The locale to be removed. May not be null.EChange.CHANGED if the text was remove,
EChange.UNCHANGED otherwise.@Nonnull public EChange clear()
IClearableclear in interface IClearableEChange.CHANGED if at least one element was cleared,
EChange.UNCHANGED otherwise.@Nonnull public EChange assignFrom(@Nonnull IReadonlyMultiLingualText aMLT)
IMultiLingualTextassignFrom in interface IMultiLingualTextaMLT - The object to read the content from. May not be null.EChange.CHANGED if the assignment changed anything,
EChange.UNCHANGED otherwise.public void addChangeNotifier(@Nonnull IChangeNotify<IMultiLingualText> aCallback)
IMultiLingualTextaddChangeNotifier in interface IMultiLingualTextaCallback - The callback to add. May not be null.Copyright © 2006–2014 phloc systems. All rights reserved.