Package com.helger.commons.text
Class AbstractMapBasedMultilingualText
- java.lang.Object
-
- com.helger.commons.text.AbstractHasText
-
- com.helger.commons.text.AbstractReadOnlyMapBasedMultilingualText
-
- com.helger.commons.text.AbstractMapBasedMultilingualText
-
- All Implemented Interfaces:
IClearable,IHasText,IHasTextWithArgs,IMultilingualText,IMutableMultilingualText,Serializable
- Direct Known Subclasses:
MultilingualText
@NotThreadSafe public abstract class AbstractMapBasedMultilingualText extends AbstractReadOnlyMapBasedMultilingualText implements IMutableMultilingualText
AMapbased implementation ofIMultilingualTextthat does also provide writing methods to the outside and is only to be used as a non-abstract base class.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMapBasedMultilingualText()protectedAbstractMapBasedMultilingualText(ICommonsOrderedMap<Locale,String> aMapToUse)Protected constructor that specifies the underlyingMapto use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EChangeaddText(Locale aContentLocale, String sText)Add a text in the specified locale.EChangeassignFrom(IMultilingualText aMLT)Assign all fields from the passed object.CallbackList<IChangeCallback<IMutableMultilingualText>>changeNotifyCallbacks()booleanequals(Object o)inthashCode()EChangeremoveAll()Reset the contents of the element to the after-construction state.EChangeremoveText(Locale aContentLocale)Remove the text with the specified locale.EChangesetText(Locale aContentLocale, String sText)Set a text in the specified locale.StringtoString()-
Methods inherited from class com.helger.commons.text.AbstractReadOnlyMapBasedMultilingualText
containsLocaleWithFallback, internalAddText, internalAddText, internalGetLocaleToUseWithFallback, internalGetText, internalSetText, isPerformConsistencyChecks, setPerformConsistencyChecks, texts
-
Methods inherited from class com.helger.commons.text.AbstractHasText
getText
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.text.IHasText
getAsHasDisplayText, getText
-
Methods inherited from interface com.helger.commons.text.IHasTextWithArgs
getAsHasDisplayTextWithArgs, getTextWithArgs, getTextWithArgs
-
Methods inherited from interface com.helger.commons.text.IMultilingualText
containsLocaleWithFallback, texts
-
-
-
-
Constructor Detail
-
AbstractMapBasedMultilingualText
protected AbstractMapBasedMultilingualText()
-
AbstractMapBasedMultilingualText
protected AbstractMapBasedMultilingualText(@Nonnull ICommonsOrderedMap<Locale,String> aMapToUse)
Protected constructor that specifies the underlyingMapto use. Use this constructor to e.g. provide a concurrentHashMapor similar.- Parameters:
aMapToUse- The map to use. Must not benulland must be writable.
-
-
Method Detail
-
addText
@Nonnull public final EChange addText(@Nonnull Locale aContentLocale, @Nullable String sText)
Description copied from interface:IMutableMultilingualTextAdd a text in the specified locale. If a text with the same locale is already present,falseis returned.- Specified by:
addTextin interfaceIMutableMultilingualText- Parameters:
aContentLocale- The locale in which the text should be set. May not benull.sText- The text to be set. May benull.- Returns:
EChange.CHANGEDif the text was added,EChange.UNCHANGEDotherwise.
-
setText
@Nonnull public final EChange setText(@Nonnull Locale aContentLocale, @Nullable String sText)
Description copied from interface:IMutableMultilingualTextSet a text in the specified locale. If a text with the same locale is already present, the old value is overwritten.- Specified by:
setTextin interfaceIMutableMultilingualText- Parameters:
aContentLocale- The locale in which the text should be set. May not benull.sText- The text to be set. May benull.- Returns:
EChange.CHANGEDif the text was set,EChange.UNCHANGEDotherwise.
-
removeText
@Nonnull public final EChange removeText(@Nonnull Locale aContentLocale)
Description copied from interface:IMutableMultilingualTextRemove the text with the specified locale.- Specified by:
removeTextin interfaceIMutableMultilingualText- Parameters:
aContentLocale- The locale to be removed. May not benull.- Returns:
EChange.CHANGEDif the text was remove,EChange.UNCHANGEDotherwise.
-
removeAll
@Nonnull public final EChange removeAll()
Description copied from interface:IClearableReset the contents of the element to the after-construction state.- Specified by:
removeAllin interfaceIClearable- Returns:
EChange.CHANGEDif at least one element was cleared,EChange.UNCHANGEDotherwise.
-
assignFrom
@Nonnull public final EChange assignFrom(@Nonnull IMultilingualText aMLT)
Description copied from interface:IMutableMultilingualTextAssign all fields from the passed object. All existing texts are removed!- Specified by:
assignFromin interfaceIMutableMultilingualText- Parameters:
aMLT- The object to read the content from. May not benull.- Returns:
EChange.CHANGEDif the assignment changed anything,EChange.UNCHANGEDotherwise.
-
changeNotifyCallbacks
@Nonnull @ReturnsMutableObject("design") public final CallbackList<IChangeCallback<IMutableMultilingualText>> changeNotifyCallbacks()
- Specified by:
changeNotifyCallbacksin interfaceIMutableMultilingualText- Returns:
- The change notify callbacks. Never
null.
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractReadOnlyMapBasedMultilingualText
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractReadOnlyMapBasedMultilingualText
-
toString
@OverridingMethodsMustInvokeSuper public String toString()
- Overrides:
toStringin classAbstractReadOnlyMapBasedMultilingualText
-
-