Class LocalizedMessage

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<LocalizedMessage>

    public final class LocalizedMessage
    extends java.lang.Object
    implements java.lang.Comparable<LocalizedMessage>, java.io.Serializable
    Represents a message that can be localised. The translations come from message.properties files. The underlying implementation uses java.text.MessageFormat.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LocalizedMessage.Utf8Control
      Custom ResourceBundle.Control implementation which allows explicitly read the properties files as UTF-8.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocalizedMessage​(int lineNo, int columnNo, int columnCharIndex, int tokenType, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, SeverityLevel severityLevel, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
      LocalizedMessage​(int lineNo, int columnNo, int tokenType, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, SeverityLevel severityLevel, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
      LocalizedMessage​(int lineNo, int columnNo, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, SeverityLevel severityLevel, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
      LocalizedMessage​(int lineNo, int columnNo, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
      LocalizedMessage​(int lineNo, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, SeverityLevel severityLevel, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
      LocalizedMessage​(int lineNo, java.lang.String bundle, java.lang.String key, java.lang.Object[] args, java.lang.String moduleId, java.lang.Class<?> sourceClass, java.lang.String customMessage)
      Creates a new LocalizedMessage instance.
    • Constructor Detail

      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                int columnNo,
                                int columnCharIndex,
                                int tokenType,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                SeverityLevel severityLevel,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance.
        Parameters:
        lineNo - line number associated with the message
        columnNo - column number associated with the message
        columnCharIndex - column char index associated with the message
        tokenType - token type of the event associated with the message. See TokenTypes
        bundle - resource bundle name
        key - the key to locate the translation
        args - arguments for the translation
        severityLevel - severity level for the message
        moduleId - the id of the module the message is associated with
        sourceClass - the Class that is the source of the message
        customMessage - optional custom message overriding the default
      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                int columnNo,
                                int tokenType,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                SeverityLevel severityLevel,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance.
        Parameters:
        lineNo - line number associated with the message
        columnNo - column number associated with the message
        tokenType - token type of the event associated with the message. See TokenTypes
        bundle - resource bundle name
        key - the key to locate the translation
        args - arguments for the translation
        severityLevel - severity level for the message
        moduleId - the id of the module the message is associated with
        sourceClass - the Class that is the source of the message
        customMessage - optional custom message overriding the default
      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                int columnNo,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                SeverityLevel severityLevel,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance.
        Parameters:
        lineNo - line number associated with the message
        columnNo - column number associated with the message
        bundle - resource bundle name
        key - the key to locate the translation
        args - arguments for the translation
        severityLevel - severity level for the message
        moduleId - the id of the module the message is associated with
        sourceClass - the Class that is the source of the message
        customMessage - optional custom message overriding the default
      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                int columnNo,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance.
        Parameters:
        lineNo - line number associated with the message
        columnNo - column number associated with the message
        bundle - resource bundle name
        key - the key to locate the translation
        args - arguments for the translation
        moduleId - the id of the module the message is associated with
        sourceClass - the Class that is the source of the message
        customMessage - optional custom message overriding the default
      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                SeverityLevel severityLevel,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance.
        Parameters:
        lineNo - line number associated with the message
        bundle - resource bundle name
        key - the key to locate the translation
        args - arguments for the translation
        severityLevel - severity level for the message
        moduleId - the id of the module the message is associated with
        sourceClass - the source class for the message
        customMessage - optional custom message overriding the default
      • LocalizedMessage

        public LocalizedMessage​(int lineNo,
                                java.lang.String bundle,
                                java.lang.String key,
                                java.lang.Object[] args,
                                java.lang.String moduleId,
                                java.lang.Class<?> sourceClass,
                                java.lang.String customMessage)
        Creates a new LocalizedMessage instance. The column number defaults to 0.
        Parameters:
        lineNo - line number associated with the message
        bundle - name of a resource bundle that contains error messages
        key - the key to locate the translation
        args - arguments for the translation
        moduleId - the id of the module the message is associated with
        sourceClass - the name of the source for the message
        customMessage - optional custom message overriding the default
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • clearCache

        public static void clearCache()
        Clears the cache.
      • getMessage

        public java.lang.String getMessage()
        Gets the translated message.
        Returns:
        the translated message
      • getLineNo

        public int getLineNo()
        Gets the line number.
        Returns:
        the line number
      • getColumnNo

        public int getColumnNo()
        Gets the column number.
        Returns:
        the column number
      • getColumnCharIndex

        public int getColumnCharIndex()
        Gets the column char index.
        Returns:
        the column char index
      • getTokenType

        public int getTokenType()
        Gets the token type.
        Returns:
        the token type
      • getSeverityLevel

        public SeverityLevel getSeverityLevel()
        Gets the severity level.
        Returns:
        the severity level
      • getModuleId

        public java.lang.String getModuleId()
        Returns id of module.
        Returns:
        the module identifier.
      • getKey

        public java.lang.String getKey()
        Returns the message key to locate the translation, can also be used in IDE plugins to map error messages to corrective actions.
        Returns:
        the message key
      • getSourceName

        public java.lang.String getSourceName()
        Gets the name of the source for this LocalizedMessage.
        Returns:
        the name of the source for this LocalizedMessage
      • setLocale

        public static void setLocale​(java.util.Locale locale)
        Sets a locale to use for localization.
        Parameters:
        locale - the locale to use for localization