Interface ModulesRule<DESCRIPTOR extends ArchModule.Descriptor>

All Superinterfaces:
ArchRule, CanBeEvaluated, CanOverrideDescription<ArchRule>, HasDescription, ModulesShouldConjunction<DESCRIPTOR>
All Known Subinterfaces:
ModulesByAnnotationRule<ANNOTATION>

@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public interface ModulesRule<DESCRIPTOR extends ArchModule.Descriptor> extends ArchRule, ModulesShouldConjunction<DESCRIPTOR>
  • Method Details

    • as

      Description copied from interface: CanOverrideDescription
      Allows to adjust the description of this object. Note that this method will not modify the current object, but instead return a new object with adjusted description.
      Specified by:
      as in interface CanOverrideDescription<DESCRIPTOR extends ArchModule.Descriptor>
      Parameters:
      newDescription - The description the result of this method will hold
      Returns:
      A new equivalent object with adjusted description
    • because

      Specified by:
      because in interface ArchRule
    • allowEmptyShould

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesRule<DESCRIPTOR> allowEmptyShould(boolean allowEmptyShould)
      Description copied from interface: ArchRule
      If set to true allows the should-clause of this rule to be checked against an empty set of elements. Otherwise, the rule will fail with a respective message. This is to prevent possible implementation errors, like filtering for a non-existing package in the that-clause causing an always-passing rule.
      Note that this method will override the configuration property archRule.failOnEmptyShould.
      Specified by:
      allowEmptyShould in interface ArchRule
      Parameters:
      allowEmptyShould - Whether the rule fails if the should-clause is evaluated with an empty set of elements
      Returns:
      A (new) ArchRule with adjusted allowEmptyShould behavior
    • ignoreDependency

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesRule<DESCRIPTOR> ignoreDependency(Class<?> origin, Class<?> target)
      Ignores all class dependencies from the given origin class to the given target class.

      Note that this will always refer to the last ArchCondition only if multiple ArchConditions are joined using ModulesShouldConjunction.andShould(). E.g.
      
       modules()...
         .should().firstCondition()
         .ignoreDependency(/* will only refer to `firstCondition`, not to `secondCondition` */)
         .andShould().secondCondition()
         .ignoreDependency(/* will only refer to `secondCondition`, not to `firstCondition` */)
       
      Parameters:
      origin - the origin class of dependencies to ignore
      target - the target class of dependencies to ignore
    • ignoreDependency

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesRule<DESCRIPTOR> ignoreDependency(String originFullyQualifiedClassName, String targetFullyQualifiedClassName)
      Ignores all class dependencies from the origin class with the given fully qualified origin class name to the target class with the given fully qualified target class name.

      Note that this will always refer to the last ArchCondition only if multiple ArchConditions are joined using ModulesShouldConjunction.andShould(). E.g.
      
       modules()...
         .should().firstCondition()
         .ignoreDependency(/* will only refer to `firstCondition`, not to `secondCondition` */)
         .andShould().secondCondition()
         .ignoreDependency(/* will only refer to `secondCondition`, not to `firstCondition` */)
       
      Parameters:
      originFullyQualifiedClassName - the fully qualified origin class of dependencies to ignore
      targetFullyQualifiedClassName - the fully qualified target class of dependencies to ignore
    • ignoreDependency

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesRule<DESCRIPTOR> ignoreDependency(Predicate<? super JavaClass> originPredicate, Predicate<? super JavaClass> targetPredicate)
      Ignores all class dependencies from any origin class matching the given origin class predicate to any target class matching the given target class predicate.

      Note that this will always refer to the last ArchCondition only if multiple ArchConditions are joined using ModulesShouldConjunction.andShould(). E.g.
      
       modules()...
         .should().firstCondition()
         .ignoreDependency(/* will only refer to `firstCondition`, not to `secondCondition` */)
         .andShould().secondCondition()
         .ignoreDependency(/* will only refer to `secondCondition`, not to `firstCondition` */)
       
      Parameters:
      originPredicate - predicate determining for which origins of dependencies the dependency should be ignored
      targetPredicate - predicate determining for which targets of dependencies the dependency should be ignored
    • ignoreDependency

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesRule<DESCRIPTOR> ignoreDependency(Predicate<? super Dependency> dependencyPredicate)
      Ignores all class dependencies matching the given predicate.

      Note that this will always refer to the last ArchCondition only if multiple ArchConditions are joined using ModulesShouldConjunction.andShould(). E.g.
      
       modules()...
         .should().firstCondition()
         .ignoreDependency(/* will only refer to `firstCondition`, not to `secondCondition` */)
         .andShould().secondCondition()
         .ignoreDependency(/* will only refer to `secondCondition`, not to `firstCondition` */)