Package com.helger.commons.text
Class AbstractReadOnlyMapBasedMultilingualText
java.lang.Object
com.helger.commons.text.AbstractHasText
com.helger.commons.text.AbstractReadOnlyMapBasedMultilingualText
- All Implemented Interfaces:
IHasText,IHasTextWithArgs,IMultilingualText,Serializable
- Direct Known Subclasses:
AbstractMapBasedMultilingualText,ReadOnlyMultilingualText
public abstract class AbstractReadOnlyMapBasedMultilingualText
extends AbstractHasText
implements IMultilingualText, Serializable
A
Map based implementation of IMultilingualText that does not
provide writing methods to the outside and is only to be used as a
non-abstract base class.- Author:
- Philip Helger
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedProtected constructor that specifies the underlyingMapto use. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancontainsLocaleWithFallback(Locale aContentLocale) Check if the passed locale is directly or by fallback contained.booleaninthashCode()protected final voidinternalAddText(Locale aContentLocale, String sValue) protected final voidinternalAddText(Map.Entry<Locale, String> aEntry) protected final LocaleinternalGetLocaleToUseWithFallback(Locale aContentLocale) Determine the locale to use.protected final StringinternalGetText(Locale aContentLocale) Main text resolving.protected final voidinternalSetText(Locale aContentLocale, String sValue) static booleanstatic voidsetPerformConsistencyChecks(boolean bPerformConsistencyChecks) Enable or disable the internal consistency checks.final ICommonsOrderedMap<Locale, String> texts()toString()Methods inherited from class com.helger.commons.text.AbstractHasText
getTextMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.text.IHasText
getAsHasDisplayText, getTextMethods inherited from interface com.helger.commons.text.IHasTextWithArgs
getAsHasDisplayTextWithArgs, getTextWithArgs, getTextWithArgs
-
Constructor Details
-
AbstractReadOnlyMapBasedMultilingualText
protected AbstractReadOnlyMapBasedMultilingualText() -
AbstractReadOnlyMapBasedMultilingualText
protected AbstractReadOnlyMapBasedMultilingualText(@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 Details
-
setPerformConsistencyChecks
public static void setPerformConsistencyChecks(boolean bPerformConsistencyChecks) Enable or disable the internal consistency checks.- Parameters:
bPerformConsistencyChecks-trueto enable them,falseto disable them.
-
isPerformConsistencyChecks
public static boolean isPerformConsistencyChecks()- Returns:
trueif consistency checks are enabled,falseif not. The default value isGlobalDebug.isDebugMode().
-
internalAddText
-
internalAddText
-
internalSetText
-
internalGetText
Description copied from class:AbstractHasTextMain text resolving. Get the text in the passed locale.- Specified by:
internalGetTextin classAbstractHasText- Parameters:
aContentLocale- Locale to use. This is the locale resolved internally. Nevernull.- Returns:
nullif no such text present in the passed locale
-
internalGetLocaleToUseWithFallback
Description copied from class:AbstractHasTextDetermine the locale to use.- Overrides:
internalGetLocaleToUseWithFallbackin classAbstractHasText- Parameters:
aContentLocale- Requested locale. Nevernull.- Returns:
- The locale to use. May be
null.
-
containsLocaleWithFallback
Description copied from interface:IMultilingualTextCheck if the passed locale is directly or by fallback contained. The implementation class MUST add locale-generalisation when resolving the text ("de_DE" => "de" => default).- Specified by:
containsLocaleWithFallbackin interfaceIMultilingualText- Parameters:
aContentLocale- The locale to check. May benull.- Returns:
trueif the locale is contained,falseif not.
-
texts
- Specified by:
textsin interfaceIMultilingualText- Returns:
- The Locale to text map. Never
null.
-
equals
-
hashCode
-
toString
-