Interface ProblemCollector<P extends BuilderProblem>

Type Parameters:
P - The type of the problem.
All Known Implementing Classes:
ProblemCollector.Impl

@Experimental public interface ProblemCollector<P extends BuilderProblem>
Collects problems that were encountered during project building.
Since:
4.0.0
  • Method Details

    • hasWarningProblems

      default boolean hasWarningProblems()
      Returns true if there is at least one problem collected with severity equal or more severe than BuilderProblem.Severity.WARNING. This check is logically equivalent to "is there any problem reported?", given warning is the lowest severity.
    • hasErrorProblems

      default boolean hasErrorProblems()
      Returns true if there is at least one problem collected with severity equal or more severe than BuilderProblem.Severity.ERROR.
    • hasFatalProblems

      default boolean hasFatalProblems()
      Returns true if there is at least one problem collected with severity equal or more severe than BuilderProblem.Severity.FATAL.
    • hasProblemsFor

      default boolean hasProblemsFor(BuilderProblem.Severity severity)
      Returns true if there is at least one problem collected with severity equal or more severe than passed in severity.
    • totalProblemsReported

      default int totalProblemsReported()
      Returns total count of problems reported.
    • problemsReportedFor

      int problemsReportedFor(BuilderProblem.Severity... severities)
      Returns count of problems reported for given severities.
    • problemsOverflow

      boolean problemsOverflow()
      Returns true if reported problem count exceeded allowed count, and issues were lost. When this method returns true, it means that element count of stream returned by method problems() and the counter returned by totalProblemsReported() are not equal (latter is bigger than former).
    • reportProblem

      boolean reportProblem(P problem)
      Reports a problem: always maintains the counters, but whether problem is preserved in memory, depends on implementation and its configuration.
      Returns:
      true if passed problem is preserved by this call.
    • problems

      @Nonnull default Stream<P> problems()
      Returns all reported and preserved problems ordered by severity in decreasing order. Note: counters and element count in this stream does not have to be equal.
    • problems

      Returns all reported and preserved problems for given severity. Note: counters and element count in this stream does not have to be equal.
    • empty

      @Nonnull static <P extends BuilderProblem> ProblemCollector<P> empty()
      Creates "empty" problem collector.
    • create

      @Nonnull static <P extends BuilderProblem> ProblemCollector<P> create(@Nullable ProtoSession protoSession)
      Creates new instance of problem collector.
    • create

      @Nonnull static <P extends BuilderProblem> ProblemCollector<P> create(int maxCountLimit)
      Creates new instance of problem collector. Visible for testing only.