Interface TranslatableException

All Known Implementing Classes:
EPersonNameNotProvidedException, GroupHasPendingWorkflowTasksException, GroupNameNotProvidedException, PasswordNotValidException, RESTBitstreamNotFoundException, RESTEmptyWorkflowGroupException

public interface TranslatableException

Implement TranslatableException to make Exceptions or RuntimeExceptions translatable.

In most cases, only getMessageKey() should be implemented; getMessage() and getLocalizedMessage() are already provided by Throwable and the default implementation of getLocalizedMessage(Context) is usually sufficient.

A locale-aware message can be obtained by calling getLocalizedMessage(Context).

Author:
Bruno Roemers (bruno.roemers at atmire.com)
  • Method Details

    • getMessageKey

      String getMessageKey()
      Returns:
      message key (used for lookup with I18nUtil)
    • getMessage

      String getMessage()
      Already implemented by Throwable.
      Returns:
      message for default locale
    • getLocalizedMessage

      String getLocalizedMessage()
      Already implemented by Throwable.
      Returns:
      message for default locale
    • getLocalizedMessage

      default String getLocalizedMessage(Context context)
      Parameters:
      context - current DSpace context (used to infer current locale)
      Returns:
      message for current locale (or default locale if current locale did not yield a result)