Package com.helger.commons.text.resolve
Class EnumTextResolverWithPropertiesOverrideAndFallback
java.lang.Object
com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
com.helger.commons.text.resolve.EnumTextResolverWithPropertiesOverrideAndFallback
- All Implemented Interfaces:
IEnumTextResolver
- Direct Known Subclasses:
DefaultTextResolver
@ThreadSafe
public class EnumTextResolverWithPropertiesOverrideAndFallback
extends AbstractEnumTextResolverWithOverrideAndFallback
Text resolving class that performs the fallback handling for locales other
than German and English. Used only from within the
DefaultTextResolver static class.- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanBy default the resource bundle cache is usedstatic final StringDefault classpath prefix for fallback resourcesstatic final StringDefault classpath prefix for override resourcesFields inherited from class com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
DEFAULT_CHECK_FOR_FALLBACK, DEFAULT_CHECK_FOR_OVERRIDE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected StringinternalGetFallbackString(String sID, Locale aContentLocale) This method must return the fallback string for the passed parameters.protected StringinternalGetOverrideString(String sID, Locale aContentLocale) This method must return the override string for the passed parameters.booleanvoidsetUseResourceBundleCache(boolean bUseResourceBundleCache) Change whether the internal resource bundle cache should be used.Methods inherited from class com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
getText, isCheckForFallback, isCheckForOverride, setCheckForFallback, setCheckForOverrideMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.commons.text.resolve.IEnumTextResolver
getTextWithArgs, getTextWithArgs
-
Field Details
-
PREFIX_OVERRIDE
Default classpath prefix for override resources- See Also:
-
PREFIX_FALLBACK
Default classpath prefix for fallback resources- See Also:
-
DEFAULT_USE_RESOURCE_BUNDLE_CACHE
public static final boolean DEFAULT_USE_RESOURCE_BUNDLE_CACHEBy default the resource bundle cache is used- See Also:
-
-
Constructor Details
-
EnumTextResolverWithPropertiesOverrideAndFallback
public EnumTextResolverWithPropertiesOverrideAndFallback()
-
-
Method Details
-
setUseResourceBundleCache
public void setUseResourceBundleCache(boolean bUseResourceBundleCache) Change whether the internal resource bundle cache should be used.- Parameters:
bUseResourceBundleCache- The new value. Passtrueto enable it.
-
isUseResourceBundleCache
public boolean isUseResourceBundleCache()- Returns:
trueif the internalResourceBundlecache should be used. The default value isDEFAULT_USE_RESOURCE_BUNDLE_CACHE.
-
internalGetOverrideString
@Nullable protected String internalGetOverrideString(@Nonnull @PropertyKey String sID, @Nonnull Locale aContentLocale) Description copied from class:AbstractEnumTextResolverWithOverrideAndFallbackThis method must return the override string for the passed parameters. This method is only called ifAbstractEnumTextResolverWithOverrideAndFallback.isCheckForOverride()istrue.- Specified by:
internalGetOverrideStringin classAbstractEnumTextResolverWithOverrideAndFallback- Parameters:
sID- Unique string IDaContentLocale- locale to use.- Returns:
- The string in the passed locale. May be
null.
-
internalGetFallbackString
@Nullable protected String internalGetFallbackString(@Nonnull @PropertyKey String sID, @Nonnull Locale aContentLocale) Description copied from class:AbstractEnumTextResolverWithOverrideAndFallbackThis method must return the fallback string for the passed parameters. This method is only called ifAbstractEnumTextResolverWithOverrideAndFallback.isCheckForFallback()istrue.- Specified by:
internalGetFallbackStringin classAbstractEnumTextResolverWithOverrideAndFallback- Parameters:
sID- Unique string IDaContentLocale- locale to use.- Returns:
- The string in the passed locale. May be
null.
-
getAllUsedOverrideBundleNames
- Returns:
- A set with all resource keys used in overriding. Never
null.
-
getAllUsedFallbackBundleNames
- Returns:
- A set with all resource keys used as fallback. Never
null.
-
clearCache
public void clearCache()
-