Class ArchCondition<T>

java.lang.Object
com.tngtech.archunit.lang.ArchCondition<T>
Direct Known Subclasses:
AllDependenciesCondition, AnyDependencyCondition, PlantUmlArchCondition

@PublicAPI(usage=INHERITANCE)
public abstract class ArchCondition<T>
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    ArchCondition​(java.lang.String description, java.lang.Object... args)  
  • Method Summary

    Modifier and Type Method Description
    ArchCondition<T> and​(ArchCondition<? super T> condition)  
    ArchCondition<T> as​(java.lang.String description, java.lang.Object... args)  
    abstract void check​(T item, ConditionEvents events)  
    void finish​(ConditionEvents events)
    Can be used/overridden to finish the evaluation of this condition.
    ArchUnit will call this method once after every single item was checked (by check(Object, ConditionEvents).
    This method can be used, if violations are dependent on multiple/all check(Object, ConditionEvents) calls, on the contrary to the default case, where each single check(Object, ConditionEvents) stands for itself.
    <U extends T>
    ArchCondition<U>
    forSubtype()  
    <U extends T>
    ArchCondition<U>
    forSubType()
    Deprecated.
    Use forSubtype() instead.
    java.lang.String getDescription()  
    void init​(java.lang.Iterable<T> allObjectsToTest)
    Can be used/overridden to prepare this condition with respect to the collection of all objects the condition will be tested against.
    ArchUnit will call this method once in the beginning, before starting to check single items.
    ArchCondition<T> or​(ArchCondition<? super T> condition)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ArchCondition

      public ArchCondition​(java.lang.String description, java.lang.Object... args)
  • Method Details

    • init

      public void init​(java.lang.Iterable<T> allObjectsToTest)
      Can be used/overridden to prepare this condition with respect to the collection of all objects the condition will be tested against.
      ArchUnit will call this method once in the beginning, before starting to check single items.
      Parameters:
      allObjectsToTest - All objects that check(Object, ConditionEvents) will be called against
    • check

      public abstract void check​(T item, ConditionEvents events)
    • finish

      public void finish​(ConditionEvents events)
      Can be used/overridden to finish the evaluation of this condition.
      ArchUnit will call this method once after every single item was checked (by check(Object, ConditionEvents).
      This method can be used, if violations are dependent on multiple/all check(Object, ConditionEvents) calls, on the contrary to the default case, where each single check(Object, ConditionEvents) stands for itself.
    • and

      public ArchCondition<T> and​(ArchCondition<? super T> condition)
    • or

      public ArchCondition<T> or​(ArchCondition<? super T> condition)
    • getDescription

      public java.lang.String getDescription()
    • as

      public ArchCondition<T> as​(java.lang.String description, java.lang.Object... args)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • forSubtype

      public <U extends T> ArchCondition<U> forSubtype()
    • forSubType

      @Deprecated public <U extends T> ArchCondition<U> forSubType()
      Deprecated.
      Use forSubtype() instead.