Interface ProblemSpec


@Incubating public interface ProblemSpec
Provides options to configure problems.
Since:
8.6
See Also:
  • Method Details

    • contextualLabel

      ProblemSpec contextualLabel(String contextualLabel)
      Declares a short, but context-dependent message for this problem.
      Parameters:
      contextualLabel - the short message
      Returns:
      this
      Since:
      8.8
    • documentedAt

      ProblemSpec documentedAt(String url)
      Declares where this problem is documented.
      Returns:
      this
      Since:
      8.6
    • fileLocation

      ProblemSpec fileLocation(String path)
      Declares that this problem is in a file.
      Parameters:
      path - the file location
      Returns:
      this
      Since:
      8.6
    • lineInFileLocation

      ProblemSpec lineInFileLocation(String path, int line)
      Declares that this problem is in a file on a line.
      Parameters:
      path - the file location
      line - the one-indexed line number
      Returns:
      this
      Since:
      8.6
    • lineInFileLocation

      ProblemSpec lineInFileLocation(String path, int line, int column)
      Declares that this problem is in a file with on a line at a certain position.
      Parameters:
      path - the file location
      line - the one-indexed line number
      column - the one-indexed column
      Returns:
      this
      Since:
      8.6
    • lineInFileLocation

      ProblemSpec lineInFileLocation(String path, int line, int column, int length)
      Declares that this problem is in a file with on a line at a certain position.
      Parameters:
      path - the file location
      line - the one-indexed line number
      column - the one-indexed column
      length - the length of the text
      Returns:
      this
      Since:
      8.6
    • offsetInFileLocation

      ProblemSpec offsetInFileLocation(String path, int offset, int length)
      Declares that this problem is in a file at a certain global position with a given length.
      Parameters:
      path - the file location
      offset - the zero-indexed global offset from the beginning of the file
      length - the length of the text
      Returns:
      this
      Since:
      8.6
    • stackLocation

      ProblemSpec stackLocation()
      Declares that this problem should automatically collect the location information based on the current stack trace.
      Returns:
      this
      Since:
      8.6
    • details

      ProblemSpec details(String details)
      The long description of this problem.
      Parameters:
      details - the details
      Returns:
      this
      Since:
      8.6
    • solution

      ProblemSpec solution(String solution)
      A description of how to solve this problem.
      Parameters:
      solution - the solution.
      Returns:
      this
      Since:
      8.6
    • additionalData

      <T extends AdditionalData> ProblemSpec additionalData(Class<T> type, Action<? super T> config)
      Declares additional data attached to the problem.
      Parameters:
      type - The type of the additional data. This can be any type that implements AdditionalData including abstract classes and interfaces. This type will be instantiated and provided as an argument for the Action passed as the second argument.

      The limitations for this type are:

      • Only get<VALUE> and set<VALUE> methods are allowed.
      • These are only allowed to use these types:
        • String
        • Boolean
        • Character
        • Byte
        • Short
        • Integer
        • Float
        • Long
        • Double
        • BigInteger
        • BigDecimal
        • File
      config - The configuration action for the additional data.
      Returns:
      this
      Throws:
      IllegalArgumentException - if the conditions for the type are not met or if a different type for the same problem id is used.
      Since:
      8.13
    • withException

      ProblemSpec withException(Throwable t)
      The exception causing this problem.
      Parameters:
      t - the exception.
      Returns:
      this
      Since:
      8.11
    • severity

      ProblemSpec severity(Severity severity)
      Declares the severity of the problem.
      Parameters:
      severity - the severity
      Returns:
      this
      Since:
      8.6