edu.umd.cs.findbugs

Class I18N

public class I18N extends Object

Singleton responsible for returning localized strings for information returned to the user.

Author: David Hovemeyer

Field Summary
static LocaledefaultLocale
static Comparator<String>designationKeyComparator
a Comparator to compare user designation keys
Method Summary
Iterator<BugPattern>bugPatternIterator()
Get an Iterator over all registered bug patterns.
StringgetAnnotationDescription(String key)
Get an annotation description string.
Collection<String>getBugCategories()
Get a Collection containing all known bug category keys.
BugCategorygetBugCategory(String category)
Get the BugCategory object for a category key.
StringgetBugCategoryDescription(String category)
Get the description of a bug category.
Collection<BugCategory>getBugCategoryObjects()
StringgetUserDesignation(String key)
Get the localized user designation string.
List<String>getUserDesignationKeys()
Get a List containing all known user designation keys keys.
List<String>getUserDesignationKeys(boolean sort)
Get a List containing all known user designation keys keys.
static I18Ninstance()
Get the single object instance.
booleanregisterBugCategory(String category, BugCategory bc)
Set the metadata for a bug category.
voidregisterBugCode(BugCode bugCode)
Register a BugCode.
voidregisterBugPattern(BugPattern bugPattern)
Register a BugPattern.

Field Detail

defaultLocale

public static final Locale defaultLocale

designationKeyComparator

public static final Comparator<String> designationKeyComparator
a Comparator to compare user designation keys

Method Detail

bugPatternIterator

public Iterator<BugPattern> bugPatternIterator()
Get an Iterator over all registered bug patterns.

getAnnotationDescription

public String getAnnotationDescription(String key)
Get an annotation description string. This is a format pattern which will describe a BugAnnotation in the context of a particular bug instance. Its single format argument is the BugAnnotation.

Parameters: key the annotation description to retrieve

getBugCategories

public Collection<String> getBugCategories()
Get a Collection containing all known bug category keys. E.g., "CORRECTNESS", "MT_CORRECTNESS", "PERFORMANCE", etc.

Returns: Collection of bug category keys.

getBugCategory

public BugCategory getBugCategory(String category)
Get the BugCategory object for a category key. Returns null if no BugCategory object can be found.

Parameters: category the category key

Returns: the BugCategory object (may be null)

getBugCategoryDescription

public String getBugCategoryDescription(String category)
Get the description of a bug category. Returns the category if no description can be found.

Parameters: category the category

Returns: the description of the category

getBugCategoryObjects

public Collection<BugCategory> getBugCategoryObjects()

getUserDesignation

public String getUserDesignation(String key)
Get the localized user designation string. Returns the key if no user designation can be found.

Parameters: key the user designation key

Returns: the localized designation string

getUserDesignationKeys

public List<String> getUserDesignationKeys()
Get a List containing all known user designation keys keys. E.g., "MOSTLY_HARMLESS", "MUST_FIX", "NOT_A_BUG", etc.

Returns: List of user designation keys

getUserDesignationKeys

public List<String> getUserDesignationKeys(boolean sort)
Get a List containing all known user designation keys keys. E.g., "MOSTLY_HARMLESS", "MUST_FIX", "NOT_A_BUG", etc. If sort == true then it will attempt to sort the List as appropriate to show the user.

Returns: List of user designation keys

instance

public static I18N instance()
Get the single object instance.

registerBugCategory

public boolean registerBugCategory(String category, BugCategory bc)
Set the metadata for a bug category. If the category's metadata has already been set, this does nothing.

Parameters: category the category key bc the BugCategory object holding the metadata for the category

Returns: false if the category's metadata has already been set, true otherwise

registerBugCode

public void registerBugCode(BugCode bugCode)
Register a BugCode.

Parameters: bugCode the BugCode

registerBugPattern

public void registerBugPattern(BugPattern bugPattern)
Register a BugPattern.

Parameters: bugPattern the BugPattern

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.