Class FindBugsMessageFormat


  • public class FindBugsMessageFormat
    extends java.lang.Object

    Format the message for a BugInstance. This class works in much the same way as java.text.MessageFormat; however, each placeholder may have an optional "key" which specifies how the object at that position should be formatted.

    Example:

     new FindBugsMessageFormat("BUG: {1} does something bad to field {2.fullField}")
     

    In this example, the method annotation at position 1 is formatted using the empty (default) key. The field annotation at position 2 is formatted using the "fullField" key, which uses the long format for the field rather than the usual "class.fieldname" format.

    Author:
    David Hovemeyer
    See Also:
    BugInstance
    • Constructor Summary

      Constructors 
      Constructor Description
      FindBugsMessageFormat​(java.lang.String pattern)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String format​(BugAnnotation[] args, ClassAnnotation primaryClass)  
      java.lang.String format​(BugAnnotation[] args, ClassAnnotation primaryClass, boolean abridgedMessages)
      Format the message using the given array of BugAnnotations as arguments to bind to the placeholders in the pattern string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FindBugsMessageFormat

        public FindBugsMessageFormat​(java.lang.String pattern)
        Constructor.
        Parameters:
        pattern - the pattern for the message
    • Method Detail

      • format

        public java.lang.String format​(BugAnnotation[] args,
                                       ClassAnnotation primaryClass,
                                       boolean abridgedMessages)
        Format the message using the given array of BugAnnotations as arguments to bind to the placeholders in the pattern string.
        Parameters:
        args - the BugAnnotations used as arguments
        primaryClass - TODO
        Returns:
        the formatted message