FindBugs™ 1.3.9

edu.umd.cs.findbugs
Class I18N

java.lang.Object
  extended by edu.umd.cs.findbugs.I18N

public class I18N
extends java.lang.Object

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

Author:
David Hovemeyer

Field Summary
static java.util.Locale defaultLocale
           
static java.util.Comparator<java.lang.String> designationKeyComparator
          a Comparator to compare user designation keys
 
Method Summary
 java.util.Iterator<BugCode> bugCodeIterator()
          Get an Iterator over all registered bug codes.
 java.util.Iterator<BugPattern> bugPatternIterator()
          Get an Iterator over all registered bug patterns.
 java.lang.String getAnnotationDescription(java.lang.String key)
          Get an annotation description string.
 java.util.Collection<java.lang.String> getBugCategories()
          Get a Collection containing all known bug category keys.
 BugCategory getBugCategory(java.lang.String category)
          Get the BugCategory object for a category key.
 java.lang.String getBugCategoryDescription(java.lang.String category)
          Get the description of a bug category.
 java.util.Collection<BugCategory> getBugCategoryObjects()
           
 BugCode getBugCode(java.lang.String shortBugType)
          Get a description for given "bug type".
 java.lang.String getBugTypeDescription(java.lang.String shortBugType)
          Get a description for given "bug type".
 java.lang.String getDetailHTML(java.lang.String key)
          Get an HTML document describing the bug pattern for given key in detail.
 java.lang.String getMessage(java.lang.String key)
          Deprecated. 
 java.lang.String getShortMessage(java.lang.String key)
          Get a short message string.
 java.lang.String getShortMessageWithoutCode(java.lang.String key)
           
 java.lang.String getUserDesignation(java.lang.String key)
          Get the localized user designation string.
 java.lang.String getUserDesignationKey(int index)
           
 java.util.List<java.lang.String> getUserDesignationKeys()
          Get a List containing all known user designation keys keys.
 java.util.List<java.lang.String> getUserDesignationKeys(boolean sort)
          Get a List containing all known user designation keys keys.
static I18N instance()
          Get the single object instance.
 BugPattern lookupBugPattern(java.lang.String bugType)
          Look up bug pattern.
 boolean registerBugCategory(java.lang.String category, BugCategory bc)
          Set the metadata for a bug category.
 void registerBugCode(BugCode bugCode)
          Register a BugCode.
 void registerBugPattern(BugPattern bugPattern)
          Register a BugPattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

designationKeyComparator

public static final java.util.Comparator<java.lang.String> designationKeyComparator
a Comparator to compare user designation keys


defaultLocale

public static final java.util.Locale defaultLocale
Method Detail

instance

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


registerBugPattern

public void registerBugPattern(BugPattern bugPattern)
Register a BugPattern.

Parameters:
bugPattern - the BugPattern

lookupBugPattern

@CheckForNull
public BugPattern lookupBugPattern(java.lang.String bugType)
Look up bug pattern.

Parameters:
bugType - the bug type for the bug pattern
Returns:
the BugPattern, or null if it can't be found

bugPatternIterator

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


bugCodeIterator

public java.util.Iterator<BugCode> bugCodeIterator()
Get an Iterator over all registered bug codes.


registerBugCode

public void registerBugCode(BugCode bugCode)
Register a BugCode.

Parameters:
bugCode - the BugCode

getMessage

@Deprecated
@NonNull
public java.lang.String getMessage(java.lang.String key)
Deprecated. 

Get a message string. This is a format pattern for describing an entire bug instance in a single line.

Parameters:
key - which message to retrieve

getShortMessage

@NonNull
public java.lang.String getShortMessage(java.lang.String key)
Get a short message string. This is a concrete string (not a format pattern) which briefly describes the type of bug, without mentioning particular a particular class/method/field.

Parameters:
key - which short message to retrieve

getShortMessageWithoutCode

@NonNull
public java.lang.String getShortMessageWithoutCode(java.lang.String key)

getDetailHTML

@NonNull
public java.lang.String getDetailHTML(java.lang.String key)
Get an HTML document describing the bug pattern for given key in detail.

Parameters:
key - which HTML details for retrieve

getAnnotationDescription

public java.lang.String getAnnotationDescription(java.lang.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

getBugCode

public BugCode getBugCode(java.lang.String shortBugType)
Get a description for given "bug type". FIXME: this is referred to elsewhere as the "bug code" or "bug abbrev". Should make the terminology consistent everywhere. In this case, the bug type refers to the short prefix code prepended to the long and short bug messages.

Parameters:
shortBugType - the short bug type code
Returns:
the description of that short bug type code means

getBugTypeDescription

@NonNull
public java.lang.String getBugTypeDescription(java.lang.String shortBugType)
Get a description for given "bug type". FIXME: this is referred to elsewhere as the "bug code" or "bug abbrev". Should make the terminology consistent everywhere. In this case, the bug type refers to the short prefix code prepended to the long and short bug messages.

Parameters:
shortBugType - the short bug type code
Returns:
the description of that short bug type code means

registerBugCategory

public boolean registerBugCategory(java.lang.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

getBugCategory

public BugCategory getBugCategory(java.lang.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 java.lang.String getBugCategoryDescription(java.lang.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

getBugCategories

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

Returns:
Collection of bug category keys.

getBugCategoryObjects

public java.util.Collection<BugCategory> getBugCategoryObjects()

getUserDesignation

public java.lang.String getUserDesignation(java.lang.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 java.util.List<java.lang.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 java.util.List<java.lang.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

getUserDesignationKey

public java.lang.String getUserDesignationKey(int index)

FindBugs™ 1.3.9

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