Class ValidationResult
Problem) in the order they
were added.
The check code of an application creates one ValidationResult for one check and passes it
to the Checks constructor. Checks and its copies from Checks.warnings()
and Checks.onTab(String) add problems to this same object. Code can also add a problem
directly with add(Problem).
After the check, an application usually sends the result to the topic
PlatformTopics.VALIDATION_FINISHED. AbstractProblemsPart shows it as a tree: errors
first, then warnings, and inside them groups by object type. An application can use hasErrors() to block an action, for example a simulation run, while the scenario has errors.
The class does not remove duplicates: if the same problem is added twice, the list contains it twice. The class is not thread-safe, so add problems from one thread.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a problem to the end of the list.Returns all problems in the order they were added.booleanChecks whether the result has at least one problem with theProblem.Severity.ERRORseverity.
-
Constructor Details
-
ValidationResult
public ValidationResult()
-
-
Method Details
-
add
Adds a problem to the end of the list.- Parameters:
problem- the problem to add, notnull; the method does not check fornull, buthasErrors()then throwsNullPointerException
-
getProblems
Returns all problems in the order they were added.The list is read-only and stays connected to this result: problems added later also appear in it. To keep a snapshot, copy the list.
- Returns:
- a read-only view of the problems; an empty list if there are no problems
-
hasErrors
public boolean hasErrors()Checks whether the result has at least one problem with theProblem.Severity.ERRORseverity. The method ignores warnings (Problem.Severity.WARNING).- Returns:
trueif there is at least one error;falseif there are no problems or all of them are warnings
-