com.puppycrawl.tools.checkstyle.api
Class LocalizedMessage

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.api.LocalizedMessage
All Implemented Interfaces:
Serializable, Comparable<LocalizedMessage>

public final class LocalizedMessage
extends Object
implements Comparable<LocalizedMessage>, Serializable

Represents a message that can be localised. The translations come from message.properties files. The underlying implementation uses java.text.MessageFormat.

Version:
1.0
Author:
Oliver Burn, lkuehne
See Also:
Serialized Form

Constructor Summary
LocalizedMessage(int aLineNo, int aColNo, String aBundle, String aKey, Object[] aArgs, SeverityLevel aSeverityLevel, String aModuleId, Class<?> aSourceClass, String aCustomMessage)
          Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, int aColNo, String aBundle, String aKey, Object[] aArgs, String aModuleId, Class<?> aSourceClass, String aCustomMessage)
          Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, String aBundle, String aKey, Object[] aArgs, SeverityLevel aSeverityLevel, String aModuleId, Class<?> aSourceClass, String aCustomMessage)
          Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, String aBundle, String aKey, Object[] aArgs, String aModuleId, Class<?> aSourceClass, String aCustomMessage)
          Creates a new LocalizedMessage instance.
 
Method Summary
 int compareTo(LocalizedMessage aOther)
          
 boolean equals(Object aObject)
           
 int getColumnNo()
           
 String getKey()
          Returns the message key to locate the translation, can also be used in IDE plugins to map error messages to corrective actions.
 int getLineNo()
           
 String getMessage()
           
 String getModuleId()
           
 SeverityLevel getSeverityLevel()
           
 String getSourceName()
           
 int hashCode()
           
static void setLocale(Locale aLocale)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        int aColNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        SeverityLevel aSeverityLevel,
                        String aModuleId,
                        Class<?> aSourceClass,
                        String aCustomMessage)
Creates a new LocalizedMessage instance.

Parameters:
aLineNo - line number associated with the message
aColNo - column number associated with the message
aBundle - resource bundle name
aKey - the key to locate the translation
aArgs - arguments for the translation
aSeverityLevel - severity level for the message
aModuleId - the id of the module the message is associated with
aSourceClass - the Class that is the source of the message
aCustomMessage - optional custom message overriding the default

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        int aColNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        String aModuleId,
                        Class<?> aSourceClass,
                        String aCustomMessage)
Creates a new LocalizedMessage instance.

Parameters:
aLineNo - line number associated with the message
aColNo - column number associated with the message
aBundle - resource bundle name
aKey - the key to locate the translation
aArgs - arguments for the translation
aModuleId - the id of the module the message is associated with
aSourceClass - the Class that is the source of the message
aCustomMessage - optional custom message overriding the default

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        SeverityLevel aSeverityLevel,
                        String aModuleId,
                        Class<?> aSourceClass,
                        String aCustomMessage)
Creates a new LocalizedMessage instance.

Parameters:
aLineNo - line number associated with the message
aBundle - resource bundle name
aKey - the key to locate the translation
aArgs - arguments for the translation
aSeverityLevel - severity level for the message
aModuleId - the id of the module the message is associated with
aSourceClass - the source class for the message
aCustomMessage - optional custom message overriding the default

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        String aModuleId,
                        Class<?> aSourceClass,
                        String aCustomMessage)
Creates a new LocalizedMessage instance. The column number defaults to 0.

Parameters:
aLineNo - line number associated with the message
aBundle - name of a resource bundle that contains error messages
aKey - the key to locate the translation
aArgs - arguments for the translation
aModuleId - the id of the module the message is associated with
aSourceClass - the name of the source for the message
aCustomMessage - optional custom message overriding the default
Method Detail

equals

public boolean equals(Object aObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getMessage

public String getMessage()
Returns:
the translated message

getLineNo

public int getLineNo()
Returns:
the line number

getColumnNo

public int getColumnNo()
Returns:
the column number

getSeverityLevel

public SeverityLevel getSeverityLevel()
Returns:
the severity level

getModuleId

public String getModuleId()
Returns:
the module identifier.

getKey

public 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 String getSourceName()
Returns:
the name of the source for this LocalizedMessage

setLocale

public static void setLocale(Locale aLocale)
Parameters:
aLocale - the locale to use for localization

compareTo

public int compareTo(LocalizedMessage aOther)

Specified by:
compareTo in interface Comparable<LocalizedMessage>


Copyright © 2001-2014. All Rights Reserved.