Class 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
  • Method Details

    • isInstantiated

      public static boolean isInstantiated()
    • getInstance

      @Nonnull public static DefaultTextResolver 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 be null.
      aTP - Text provider. May not be null.
      aContentLocale - Locale to use. May not be null.
      Returns:
      null if 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 args
      Get text
      Parameters:
      aEnum - Enumeration entry. May not be null.
      aTP - Text provider. May not be null.
      aContentLocale - Locale to use. May not be null.
      Returns:
      null if 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 be null.
      aTP - Text provider. May not be null.
      aContentLocale - Locale to use. May not be null.
      aArgs - The arguments to be added for the placeholders. May neither be null nor empty.
      Returns:
      null if the text is not available in the specific locale