Package org.gradle.api.problems
Class ProblemId
java.lang.Object
org.gradle.api.problems.ProblemId
Represents a unique identifier for a problem definition.
Problem IDs are defined with a name and with group hierarchy. For example, in the domain of Java compilation problems, the id object for unused variable warnings would be:
ProblemId(name: unused-variable, displayName: Unused Variable, group:
ProblemGroup(name: java, displayName: Java compilation, parent:
ProblemGroup(name: compilation, displayName: Compilation, parent: null)))
From the name fields a fully qualified name can be inferred: compilation:java:unused-variable.
Also, the display names are intended for display on some user interface. Consumers of problem reports can build a tree representation of problems:
(Problem view)
Compilation
Java compilation
Foo.java#L10: unused variable a
Foo.java#L20: unused variable b
- Since:
- 8.13
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProblemIdcreate(String name, String displayName, ProblemGroup group) Creates a new problem id.abstract StringA human-readable label describing the problem ID.abstract ProblemGroupgetGroup()The parent group.abstract StringgetName()The name of the problem.
-
Constructor Details
-
ProblemId
protected ProblemId()Constructor.- Since:
- 8.13
-
-
Method Details
-
getName
The name of the problem.Then name should be used categorize to create a fully qualified name and to categorize a set of problems. The name itself does not need to be unique, the uniqueness is determined the name and the group hierarchy.
- Since:
- 8.13
-
getDisplayName
A human-readable label describing the problem ID.The display name should be used to present the problem to the user.
- Since:
- 8.13
-
getGroup
The parent group.- Since:
- 8.13
-
create
Creates a new problem id.- Parameters:
name- the name of the problem. The convention is to use kebab-case (ie lower case with hyphens).displayName- the user-friendly display name of the problemgroup- the group to which the problem belongs- Returns:
- the new problem id
- Since:
- 8.13
-