public abstract class AbstractReadOnlyMapBasedMultilingualText extends AbstractHasTextWithArgs implements IMultilingualText
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.| Modifier | Constructor and Description |
|---|---|
|
AbstractReadOnlyMapBasedMultilingualText() |
protected |
AbstractReadOnlyMapBasedMultilingualText(Map<Locale,String> aMapToUse)
Protected constructor that specifies the underlying
Map to use. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsLocale(Locale aLocale)
Check if the passed locale is directly contained.
|
boolean |
containsLocaleWithFallback(Locale aContentLocale)
Check if the passed locale is directly or by fallback contained.
|
boolean |
equals(Object o) |
Set<Locale> |
getAllLocales() |
Map<Locale,String> |
getAllTexts() |
int |
getLocaleCount() |
int |
getSize() |
int |
hashCode() |
protected void |
internalAddText(Locale aContentLocale,
String sValue) |
protected void |
internalAddText(Map.Entry<Locale,String> aEntry) |
protected void |
internalClear() |
protected Set<Locale> |
internalGetAllLocales() |
protected Locale |
internalGetLocaleToUseWithFallback(Locale aContentLocale)
Determine the locale to use.
|
protected Map<Locale,String> |
internalGetMap() |
protected String |
internalGetText(Locale aContentLocale)
Main text resolving.
|
protected EChange |
internalRemoveText(Locale aContentLocale) |
protected void |
internalSetText(Locale aContentLocale,
String sValue) |
boolean |
isEmpty() |
static boolean |
isPerformConsistencyChecks() |
static void |
setPerformConsistencyChecks(boolean bPerformConsistencyChecks)
Enable or disable the internal consistency checks.
|
String |
toString() |
getTextWithArgs, getTextWithArgsgetTextclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTextWithArgs, getTextWithArgspublic AbstractReadOnlyMapBasedMultilingualText()
protected AbstractReadOnlyMapBasedMultilingualText(@Nonnull Map<Locale,String> aMapToUse)
Map to use. Use
this constructor to e.g. provide a concurrent HashMap or similar.aMapToUse - The map to use. Must not be null and must be writable.public static void setPerformConsistencyChecks(boolean bPerformConsistencyChecks)
bPerformConsistencyChecks - true to enable them, false to disable
them.public static boolean isPerformConsistencyChecks()
true if consistency checks are enabled,
false if not. The default value is
GlobalDebug.isDebugMode().protected final void internalAddText(@Nonnull Locale aContentLocale, @Nullable String sValue)
protected final void internalSetText(@Nonnull Locale aContentLocale, @Nullable String sValue)
@Nonnull protected final EChange internalRemoveText(@Nullable Locale aContentLocale)
protected final void internalClear()
@Nonnull @ReturnsMutableObject(value="Internal use only") protected final Map<Locale,String> internalGetMap()
@Nullable protected final Locale internalGetLocaleToUseWithFallback(@Nonnull Locale aContentLocale)
AbstractHasTextinternalGetLocaleToUseWithFallback in class AbstractHasTextaContentLocale - Requested locale. Never null.null.@Nullable protected final String internalGetText(@Nonnull Locale aContentLocale)
AbstractHasTextinternalGetText in class AbstractHasTextaContentLocale - Locale to use. This is the locale resolved internally. Never
null.null if no such text present in the passed locale@Nonnull @ReturnsMutableObject(value="Internal use only") protected final Set<Locale> internalGetAllLocales()
@Nonnull @ReturnsMutableCopy public final Set<Locale> getAllLocales()
getAllLocales in interface IHasLocalesnull.@Nonnegative public final int getLocaleCount()
getLocaleCount in interface IHasLocalespublic final boolean containsLocale(@Nullable Locale aLocale)
IHasLocalescontainsLocale in interface IHasLocalesaLocale - The locale to check. May be null.true if the locale is directly contained,
false if not.public final 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 final Map<Locale,String> getAllTexts()
getAllTexts in interface IMultilingualTextnull
.@Nonnegative public final int getSize()
public final boolean isEmpty()
isEmpty in interface IHasSizetrue if no items are present, false if at
least a single item is present.IHasSize.getSize()@OverridingMethodsMustInvokeSuper public boolean equals(Object o)
@OverridingMethodsMustInvokeSuper public int hashCode()
@OverridingMethodsMustInvokeSuper public String toString()
Copyright © 2014–2015 Philip Helger. All rights reserved.