Class LocalizableException

All Implemented Interfaces:
Serializable

public class LocalizableException extends IllegalArgumentException
Exception that supports localized messages through LanguageMessageProvider. Can be used with or without a Language instance for localization.
See Also:
  • Constructor Details

    • LocalizableException

      public LocalizableException(LanguageMessageProvider messageKey, Object... args)
      Create exception with a localized message key and arguments
      Parameters:
      messageKey - the message key for localization
      args - arguments to be used in message formatting
    • LocalizableException

      public LocalizableException(Language language, LanguageMessageProvider messageKey, Object... args)
      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 localization
      args - arguments to be used in message formatting
  • Method Details

    • getLocalizedMessage

      public String getLocalizedMessage(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.
      Parameters:
      language - the Language instance to use for translation
      Returns:
      the localized message
    • getMessageKey

      public LanguageMessageProvider getMessageKey()
      Get the message key
      Returns:
      the message key
    • getArgs

      public Object[] getArgs()
      Get the message arguments
      Returns:
      the arguments