Package com.tngtech.archunit.lang
Class EvaluationResult
- java.lang.Object
-
- com.tngtech.archunit.lang.EvaluationResult
-
public final class EvaluationResult extends java.lang.ObjectRepresents the result of evaluating anArchRuleagainst someJavaClasses. To react to failures during evaluation of the rule, one can usehandleViolations(ViolationHandler):
result.handleViolations(new ViolationHandler<JavaAccess<?>>() { @Override public void handle(Collection<JavaAccess<?>> violatingObjects, String message) { // do some reporting or react in any way to violation } });
-
-
Constructor Summary
Constructors Constructor Description EvaluationResult(HasDescription rule, ConditionEvents events, Priority priority)EvaluationResult(HasDescription rule, Priority priority)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(EvaluationResult part)EvaluationResultfilterDescriptionsMatching(Predicate<java.lang.String> linePredicate)Filters all recordedConditionEventsby their textual description.FailureReportgetFailureReport()PrioritygetPriority()voidhandleViolations(ViolationHandler<?> violationHandler)booleanhasViolation()
-
-
-
Constructor Detail
-
EvaluationResult
@PublicAPI(usage=ACCESS) public EvaluationResult(HasDescription rule, Priority priority)
-
EvaluationResult
@PublicAPI(usage=ACCESS) public EvaluationResult(HasDescription rule, ConditionEvents events, Priority priority)
-
-
Method Detail
-
getFailureReport
@PublicAPI(usage=ACCESS) public FailureReport getFailureReport()
-
add
@PublicAPI(usage=ACCESS) public void add(EvaluationResult part)
-
handleViolations
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public void handleViolations(ViolationHandler<?> violationHandler)
-
hasViolation
@PublicAPI(usage=ACCESS) public boolean hasViolation()
-
getPriority
@PublicAPI(usage=ACCESS) public Priority getPriority()
-
filterDescriptionsMatching
@PublicAPI(usage=ACCESS) public EvaluationResult filterDescriptionsMatching(Predicate<java.lang.String> linePredicate)
Filters all recordedConditionEventsby their textual description. I.e. the lines of the description of an event are passed to the supplied predicate to decide if the event is relevant.- Parameters:
linePredicate- A predicate to determine which lines of events match. Predicate.apply(..) == true will imply the violation will be preserved.- Returns:
- A new
EvaluationResultcontaining only matching events
-
-