Class LocaleFormatter

java.lang.Object
com.appiancorp.suiteapi.common.exceptions.LocaleFormatter
All Implemented Interfaces:
AppianErrorCodeTitleFormatter, AppianErrorCodeFormatter

public class LocaleFormatter extends Object implements AppianErrorCodeFormatter, AppianErrorCodeTitleFormatter
ErrorCodeFormatter based upon a Locale.
  • Constructor Details

    • LocaleFormatter

      public LocaleFormatter(Locale locale)
  • Method Details

    • format

      public String format(AppianErrorCode errorCode, Object... arguments)
      Specified by:
      format in interface AppianErrorCodeFormatter
    • formatTitle

      public String formatTitle(AppianErrorCode errorCode, Object... arguments)
      Returns the localized title, rendered with the included arguments if the error title supports them. If the title does not exist, the method returns "".
      Specified by:
      formatTitle in interface AppianErrorCodeTitleFormatter
      Parameters:
      errorCode - The code corresponding to the thrown exception
      arguments - Additional parameters required to render the title
      Returns:
      The title, localized and rendered with the included arguments where applicable.
    • getText

      public static String getText(Class<?> clazz, Locale targetLocale, String key, Object[] params)
      Manually fetch error code text Useful in case that the locale is not available in context and error code is not automatically converted to correct locale text