com.puppycrawl.tools.checkstyle.api

Class LocalizedMessage

Implemented Interfaces:
Comparable

public final class LocalizedMessage
extends Object
implements Comparable

Represents a message that can be localised. The translations come from message.properties files. The underlying implementation uses java.text.MessageFormat.
Version:
1.0
Authors:
Oliver Burn
lkuehne

Constructor Summary

LocalizedMessage(int aLineNo, String aBundle, String aKey, Object[] aArgs, Class aSourceClass)
Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, String aBundle, String aKey, Object[] aArgs, SeverityLevel aSeverityLevel, Class aSourceClass)
Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, int aColNo, String aBundle, String aKey, Object[] aArgs, Class aSourceClass)
Creates a new LocalizedMessage instance.
LocalizedMessage(int aLineNo, int aColNo, String aBundle, String aKey, Object[] aArgs, SeverityLevel aSeverityLevel, Class aSourceClass)
Creates a new LocalizedMessage instance.

Method Summary

int
compareTo(Object 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()
SeverityLevel
getSeverityLevel()
String
getSourceName()
int
hashCode()
static void
setLocale(Locale aLocale)

Constructor Details

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        Class aSourceClass)
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
aSourceClass - the name of the source for the message

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        SeverityLevel aSeverityLevel,
                        Class aSourceClass)
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
aSourceClass - the source class for the message

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        int aColNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        Class aSourceClass)
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
aSourceClass - the Class that is the source of the message

LocalizedMessage

public LocalizedMessage(int aLineNo,
                        int aColNo,
                        String aBundle,
                        String aKey,
                        Object[] aArgs,
                        SeverityLevel aSeverityLevel,
                        Class aSourceClass)
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
aSourceClass - the Class that is the source of the message

Method Details

compareTo

public int compareTo(Object aOther)

equals

public boolean equals(Object aObject)

getColumnNo

public int getColumnNo()
Returns:
the column number *

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

getLineNo

public int getLineNo()
Returns:
the line number *

getMessage

public String getMessage()
Returns:
the translated message *

getSeverityLevel

public SeverityLevel getSeverityLevel()
Returns:
the severity level *

getSourceName

public String getSourceName()
Returns:
the name of the source for this LocalizedMessage

hashCode

public int hashCode()

setLocale

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