Class Description.Builder

java.lang.Object
com.google.errorprone.matchers.Description.Builder
Enclosing class:
Description

public static class Description.Builder
extends Object
Builder for Descriptions.
  • Method Details

    • addFix

      public Description.Builder addFix​(Fix fix)
      Adds a suggested fix for this Description. Fixes should be added in order of decreasing preference. Adding an empty fix is a no-op.
      Parameters:
      fix - a suggested fix for this problem
      Throws:
      NullPointerException - if fix is null
    • addFix

      public Description.Builder addFix​(Optional<? extends Fix> fix)
      Adds a suggested fix for this Description if fix is present. Fixes should be added in order of decreasing preference. Adding an empty fix is a no-op.
      Parameters:
      fix - a suggested fix for this problem
      Throws:
      NullPointerException - if fix is null
    • addAllFixes

      public Description.Builder addAllFixes​(List<? extends Fix> fixes)
      Add each fix in order.
      Parameters:
      fixes - a list of suggested fixes for this problem
      Throws:
      NullPointerException - if fixes or any of its elements are null
    • setMessage

      public Description.Builder setMessage​(String message)
      Set a custom error message for this Description. The custom message will be used instead of the summary field as the text for the diagnostic message.
      Parameters:
      message - A custom error message without the check name ("[checkname]") or link
    • setLinkUrl

      public Description.Builder setLinkUrl​(String linkUrl)
      Set a custom link URL. The custom URL will be used instead of the default one which forms part of the @BugPattern.
    • build

      public Description build()