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 theDefaultTextResolverstatic class.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_USE_RESOURCE_BUNDLE_CACHEBy default the resource bundle cache is usedstatic StringPREFIX_FALLBACKDefault classpath prefix for fallback resourcesstatic StringPREFIX_OVERRIDEDefault classpath prefix for override resources-
Fields inherited from class com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
DEFAULT_CHECK_FOR_FALLBACK, DEFAULT_CHECK_FOR_OVERRIDE
-
-
Constructor Summary
Constructors Constructor Description EnumTextResolverWithPropertiesOverrideAndFallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()ICommonsSet<String>getAllUsedFallbackBundleNames()ICommonsSet<String>getAllUsedOverrideBundleNames()protected 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.booleanisUseResourceBundleCache()voidsetUseResourceBundleCache(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, setCheckForOverride
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.helger.commons.text.resolve.IEnumTextResolver
getTextWithArgs, getTextWithArgs
-
-
-
-
Field Detail
-
PREFIX_OVERRIDE
public static final String PREFIX_OVERRIDE
Default classpath prefix for override resources- See Also:
- Constant Field Values
-
PREFIX_FALLBACK
public static final String PREFIX_FALLBACK
Default classpath prefix for fallback resources- See Also:
- Constant Field Values
-
DEFAULT_USE_RESOURCE_BUNDLE_CACHE
public static final boolean DEFAULT_USE_RESOURCE_BUNDLE_CACHE
By default the resource bundle cache is used- See Also:
- Constant Field Values
-
-
Method Detail
-
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
@Nonnull @ReturnsMutableCopy public ICommonsSet<String> getAllUsedOverrideBundleNames()
- Returns:
- A set with all resource keys used in overriding. Never
null.
-
getAllUsedFallbackBundleNames
@Nonnull @ReturnsMutableCopy public ICommonsSet<String> getAllUsedFallbackBundleNames()
- Returns:
- A set with all resource keys used as fallback. Never
null.
-
clearCache
public void clearCache()
-
-