1
2
3
4
5
6 package dev.metaschema.core.model.validation;
7
8 import java.util.Collections;
9 import java.util.List;
10
11 import dev.metaschema.core.model.constraint.IConstraint.Level;
12 import edu.umd.cs.findbugs.annotations.NonNull;
13
14
15
16
17 public interface IValidationResult {
18
19
20
21 @NonNull
22 IValidationResult PASSING_RESULT = new IValidationResult() {
23
24 @Override
25 public boolean isPassing() {
26 return true;
27 }
28
29 @Override
30 public Level getHighestSeverity() {
31 return Level.INFORMATIONAL;
32 }
33
34 @SuppressWarnings("null")
35 @Override
36 public List<? extends IValidationFinding> getFindings() {
37 return Collections.emptyList();
38 }
39 };
40
41
42
43
44
45
46
47 default boolean isPassing() {
48 return getHighestSeverity().ordinal() < Level.ERROR.ordinal();
49 }
50
51
52
53
54
55
56
57
58 @NonNull
59 Level getHighestSeverity();
60
61
62
63
64
65
66 @NonNull
67 List<? extends IValidationFinding> getFindings();
68 }