Class SimpleConditionEvent

java.lang.Object
com.tngtech.archunit.lang.SimpleConditionEvent
All Implemented Interfaces:
ConditionEvent

@PublicAPI(usage=ACCESS) public final class SimpleConditionEvent extends Object implements ConditionEvent
  • Constructor Details

    • SimpleConditionEvent

      public SimpleConditionEvent(Object correspondingObject, boolean conditionSatisfied, String message)
  • Method Details

    • isViolation

      public boolean isViolation()
      Specified by:
      isViolation in interface ConditionEvent
      Returns:
      true if this event represents a violation of an evaluated rule, false otherwise
    • invert

      public ConditionEvent invert()
      Specified by:
      invert in interface ConditionEvent
      Returns:
      the 'opposite' of the event.
      Assume 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 evaluating ConditionEvent.isViolation() inverted.
    • getDescriptionLines

      public List<String> getDescriptionLines()
      Specified by:
      getDescriptionLines in interface ConditionEvent
      Returns:
      A textual description of this event as a list of lines
    • handleWith

      public void handleWith(ConditionEvent.Handler handler)
      Description copied from interface: ConditionEvent
      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).
      Specified by:
      handleWith in interface ConditionEvent
      Parameters:
      handler - The handler to supply the data of this event to.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • violated

      public static ConditionEvent violated(Object correspondingObject, String message)
    • satisfied

      public static ConditionEvent satisfied(Object correspondingObject, String message)