Package com.tngtech.archunit.lang
Interface ConditionEvent
-
- All Known Implementing Classes:
SimpleConditionEvent
@PublicAPI(usage=INHERITANCE) public interface ConditionEvent
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ConditionEvent.Handler
Handles the data of aConditionEvent
that is the corresponding objects and the description (comparehandleWith(Handler)
).
As an example, this could be a single element of typeJavaMethodCall
together with a description, like
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addInvertedTo(ConditionEvents events)
Adds the 'opposite' of the event.void
describeTo(CollectsLines messages)
Deprecated.This method will be removed in the future in favor of the simplergetDescriptionLines()
.
describeTo(lineCollector)
has the same behavior as simply adding allgetDescriptionLines()
to thelineCollector
.java.util.List<java.lang.String>
getDescriptionLines()
void
handleWith(ConditionEvent.Handler handler)
Supplies the corresponding objects and description to the supplied handler.boolean
isViolation()
-
-
-
Method Detail
-
isViolation
boolean isViolation()
- Returns:
- true, IFF this event represents a violation of an evaluated rule.
-
addInvertedTo
void addInvertedTo(ConditionEvents events)
Adds the 'opposite' of the event.
E.g. The event is a violation, if some conditions A and B are both true?
-> The 'inverted' event is a violation if either A or B (or both) are not true
In the most simple case, this is just an equivalent event evaluatingisViolation()
inverted.- Parameters:
events
- The events to add the 'inverted self' to
-
describeTo
@Deprecated void describeTo(CollectsLines messages)
Deprecated.This method will be removed in the future in favor of the simplergetDescriptionLines()
.
describeTo(lineCollector)
has the same behavior as simply adding allgetDescriptionLines()
to thelineCollector
.Adds a textual description of this event to the suppliedCollectsLines
.- Parameters:
messages
- The message lines to append the description to.
-
getDescriptionLines
java.util.List<java.lang.String> getDescriptionLines()
- Returns:
- A textual description of this event as a list of lines
-
handleWith
@PublicAPI(usage=INHERITANCE, state=EXPERIMENTAL) void handleWith(ConditionEvent.Handler handler)
Supplies the corresponding objects and description to the supplied handler.
The term "corresponding objects" refers to the objects involved in the evaluation of this rule. E.g. the rule checks for illegal field accesses, then this object might be a single field access checked by the rule.
May also be a collection of objects, if the evaluation of the rule depends on sets of objects. E.g. the rule checks that some access to another class happened? The rule can only be violated, by a whole set (all accesses from a class) of objects, but not by a single one (if there is more than one).- Parameters:
handler
- The handler to supply the data of this event to.
-
-