Class LocalizableException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
com.smeup.kokos.sdk.util.exception.LocalizableException
- All Implemented Interfaces:
Serializable
Exception that supports localized messages through LanguageMessageProvider.
Can be used with or without a Language instance for localization.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLocalizableException(LanguageMessageProvider messageKey, Object... args) Create exception with a localized message key and argumentsLocalizableException(Language language, LanguageMessageProvider messageKey, Object... args) Create exception with a Language instance for immediate localization -
Method Summary
Modifier and TypeMethodDescriptionObject[]getArgs()Get the message argumentsgetLocalizedMessage(Language language) Get the localized message using the provided Language instance If a Language was provided in the constructor, getMessage() will already return the localized version.Get the message keyMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LocalizableException
Create exception with a localized message key and arguments- Parameters:
messageKey- the message key for localizationargs- arguments to be used in message formatting
-
LocalizableException
Create exception with a Language instance for immediate localization- Parameters:
language- the Language instance to use for translation (can be null)messageKey- the message key for localizationargs- arguments to be used in message formatting
-
-
Method Details
-
getLocalizedMessage
Get the localized message using the provided Language instance If a Language was provided in the constructor, getMessage() will already return the localized version.- Parameters:
language- the Language instance to use for translation- Returns:
- the localized message
-
getMessageKey
Get the message key- Returns:
- the message key
-
getArgs
Get the message arguments- Returns:
- the arguments
-