Package com.helger.commons.text.resolve
Class DefaultTextResolver
java.lang.Object
com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
com.helger.commons.text.resolve.EnumTextResolverWithPropertiesOverrideAndFallback
com.helger.commons.text.resolve.DefaultTextResolver
- All Implemented Interfaces:
IEnumTextResolver
@ThreadSafe
@Singleton
public final class DefaultTextResolver
extends EnumTextResolverWithPropertiesOverrideAndFallback
Resolves texts either from a text provider or otherwise uses a fallback to a
file, based on the given enum constant.
- Author:
- Philip Helger
-
Field Summary
Fields inherited from class com.helger.commons.text.resolve.EnumTextResolverWithPropertiesOverrideAndFallback
DEFAULT_USE_RESOURCE_BUNDLE_CACHE, PREFIX_FALLBACK, PREFIX_OVERRIDEFields inherited from class com.helger.commons.text.resolve.AbstractEnumTextResolverWithOverrideAndFallback
DEFAULT_CHECK_FOR_FALLBACK, DEFAULT_CHECK_FOR_OVERRIDE -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultTextResolverstatic StringgetTextStatic(Enum<?> aEnum, IHasText aTP, Locale aContentLocale) Get textstatic StringgetTextWithArgsStatic(Enum<?> aEnum, IHasTextWithArgs aTP, Locale aContentLocale) Deprecated.Don't call this; Use the version without "WithArgs" because there are no argsstatic StringgetTextWithArgsStatic(Enum<?> aEnum, IHasTextWithArgs aTP, Locale aContentLocale, Object... aArgs) Get textstatic booleanMethods inherited from class com.helger.commons.text.resolve.EnumTextResolverWithPropertiesOverrideAndFallback
clearCache, getAllUsedFallbackBundleNames, getAllUsedOverrideBundleNames, internalGetFallbackString, internalGetOverrideString, isUseResourceBundleCache, setUseResourceBundleCacheMethods 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
-
Method Details
-
isInstantiated
public static boolean isInstantiated() -
getInstance
- Returns:
- The singleton instance. Never
null.
-
getTextStatic
@Nullable public static String getTextStatic(@Nonnull Enum<?> aEnum, @Nonnull IHasText aTP, @Nonnull Locale aContentLocale) Get text- Parameters:
aEnum- Enumeration entry. May not benull.aTP- Text provider. May not benull.aContentLocale- Locale to use. May not benull.- Returns:
nullif the text is not available in the specific locale
-
getTextWithArgsStatic
@Nullable @Deprecated(forRemoval=false) @DevelopersNote("Use getTextStatic instead when no argument is needed!") public static String getTextWithArgsStatic(@Nonnull Enum<?> aEnum, @Nonnull IHasTextWithArgs aTP, @Nonnull Locale aContentLocale) Deprecated.Don't call this; Use the version without "WithArgs" because there are no argsGet text- Parameters:
aEnum- Enumeration entry. May not benull.aTP- Text provider. May not benull.aContentLocale- Locale to use. May not benull.- Returns:
nullif the text is not available in the specific locale
-
getTextWithArgsStatic
@Nullable public static String getTextWithArgsStatic(@Nonnull Enum<?> aEnum, @Nonnull IHasTextWithArgs aTP, @Nonnull Locale aContentLocale, @Nullable Object... aArgs) Get text- Parameters:
aEnum- Enumeration entry. May not benull.aTP- Text provider. May not benull.aContentLocale- Locale to use. May not benull.aArgs- The arguments to be added for the placeholders. May neither benullnor empty.- Returns:
nullif the text is not available in the specific locale
-