Package org.dspace.app.rest.exception
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 Summary
Modifier and TypeMethodDescriptionAlready implemented byThrowable.default StringgetLocalizedMessage(Context context) Already implemented byThrowable.
-
Method Details
-
getMessageKey
String getMessageKey()- Returns:
- message key (used for lookup with
I18nUtil)
-
getMessage
String getMessage()Already implemented byThrowable.- Returns:
- message for default locale
-
getLocalizedMessage
String getLocalizedMessage()Already implemented byThrowable.- Returns:
- message for default locale
-
getLocalizedMessage
- 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)
-