Class AbstractHasText

java.lang.Object
com.helger.commons.text.AbstractHasText
All Implemented Interfaces:
IHasText
Direct Known Subclasses:
AbstractReadOnlyMapBasedMultilingualText, ConstantHasText, ConstantHasTextWithArgs, ResourceBundleTextProvider

public abstract class AbstractHasText extends Object implements IHasText
An abstract implementation of the IHasText that has default implementations for the formatting things.
Author:
Philip Helger
  • Constructor Details

    • AbstractHasText

      protected AbstractHasText()
  • Method Details

    • internalGetLocaleToUseWithFallback

      @Nullable protected Locale internalGetLocaleToUseWithFallback(@Nonnull Locale aContentLocale)
      Determine the locale to use.
      Parameters:
      aContentLocale - Requested locale. Never null.
      Returns:
      The locale to use. May be null.
    • internalGetText

      @Nullable protected abstract String internalGetText(@Nonnull Locale aContentLocale)
      Main text resolving. Get the text in the passed locale.
      Parameters:
      aContentLocale - Locale to use. This is the locale resolved internally. Never null.
      Returns:
      null if no such text present in the passed locale
    • getText

      @Nullable public final String getText(@Nonnull Locale aContentLocale)
      Description copied from interface: IHasText
      Get the text specific for the passed locale. The implementation class MAY add locale-generalisation when resolving the text ("de_DE" => "de" => default).
      Specified by:
      getText in interface IHasText
      Parameters:
      aContentLocale - The locale to use. May not be null.
      Returns:
      null if no text for the given locale was found.