Interface ILocaleStringFormatter

All Known Subinterfaces:
ILocaleKStringFormatter
All Known Implementing Classes:
References.Result

public interface ILocaleStringFormatter
Helper to format a message with parameters for a class in the appropriate String form.
Author:
Christopher Mindus
  • Field Details

    • EMPTY

      static final Object[] EMPTY
      Empty parameter array.
  • Method Details

    • getFormatterString

      String getFormatterString(ILocaleString localeString, IKStringInfoProvider provider, LocaleInfo localeInfo)
      Gets the String used to format the locale string.
      Parameters:
      localeString - The locale string instance, or null to look it up from current thread or system.
      provider - The information provider or null for none.
      localeInfo - The Locale information, or null to look it up from the current thread if needed.
      Returns:
      The locale string to format with potential parameters.
    • getFormatterParams

      Object[] getFormatterParams(ILocaleString localeString, IKStringInfoProvider provider, LocaleInfo localeInfo)
      Gets the parameters used to format the String.
      Parameters:
      localeString - The locale string instance, or null to look it up from current thread or system.
      provider - The information provider or null for none.
      localeInfo - The Locale information, or null to look it up from the current thread if needed.
      Returns:
      An array of parameters used to format the String. The return value can be set to null in which case an empty array is used for the formatter.
    • getMessageLocaleString

      default String getMessageLocaleString()
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      The locale is looked up from the current thread if required.

      Returns:
      The formatted String.
      See Also:
    • getMessageLocaleString

      default String getMessageLocaleString(Locale locale)
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      Parameters:
      locale - The Locale, or null to look it up for the current thread if needed.
      Returns:
      The formatted String.
      See Also:
    • getMessageLocaleString

      default String getMessageLocaleString(ILocaleString localeString)
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      Parameters:
      localeString - The locale string instance, or null for current session.
      Returns:
      The formatted String.
      See Also:
    • getMessageLocaleString

      default String getMessageLocaleString(LocaleInfo localeInfo)
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      Parameters:
      localeInfo - The Locale information, or null to look it up from the current thread if needed.
      Returns:
      The formatted String.
      See Also:
    • getMessageLocaleString

      default String getMessageLocaleString(ILocaleString localeString, LocaleInfo localeInfo)
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      Parameters:
      localeString - The locale string instance, or null for current session.
      localeInfo - The Locale information, or null to look it up from the current thread if needed.
      Returns:
      The formatted String.
      See Also:
    • getMessageLocaleString

      default String getMessageLocaleString(ILocaleString localeString, IKStringInfoProvider provider, LocaleInfo localeInfo)
      Gets a formatted String with the appropriate parameters using the formatting described below.

      Formats a String using curly brackets {} as parameter or {param_index} parameter where param_index is an optional one-based index value, AND/OR the Java String.format(Locale, String, Object...) method using parameters in the form of %[flags][width]conversion or %[argument_index$][flags][width]conversion.

      Parameters referenced by {[param_index]} are converted toString() using {@link Utilities#toString()} enable e.g. deep-to-String of e.g. Exceptions, Arrays, etc.. Parameters references e.g. using %s will not receive this "toString" conversion (unless they target the same param_index.

      The formatting string replaces {} with %s and {param_index} with %param_index$s.

      Parameters:
      localeString - The locale string instance, or null to look it up from current thread or system.
      provider - The information provider or null for none.
      localeInfo - The Locale information, or null to look it up from the current thread if needed.
      Returns:
      The formatted String.
      See Also: