Interface ModulesByAnnotationRule<ANNOTATION extends Annotation>
- All Superinterfaces:
ArchRule,CanBeEvaluated,CanOverrideDescription<ArchRule>,HasDescription,ModulesRule<AnnotationDescriptor<ANNOTATION>>,ModulesShouldConjunction<AnnotationDescriptor<ANNOTATION>>
@PublicAPI(usage=ACCESS,
state=EXPERIMENTAL)
public interface ModulesByAnnotationRule<ANNOTATION extends Annotation>
extends ModulesRule<AnnotationDescriptor<ANNOTATION>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tngtech.archunit.lang.ArchRule
ArchRule.Assertions, ArchRule.Factory, ArchRule.Transformation -
Method Summary
Modifier and TypeMethodDescriptionallowEmptyShould(boolean allowEmptyShould) If set totrueallows the should-clause of this rule to be checked against an empty set of elements.LikeModulesShouldConjunction.andShould(ArchCondition)but offers a fluent API to pick the condition to join.Allows to adjust the description of this object.ignoreDependency(Class<?> origin, Class<?> target) Ignores all class dependencies from the given origin class to the given target class.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.ignoreDependency(Predicate<? super Dependency> dependencyPredicate) Ignores all class dependencies matching the given predicate.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.Methods inherited from interface com.tngtech.archunit.lang.CanBeEvaluated
evaluateMethods inherited from interface com.tngtech.archunit.base.HasDescription
getDescriptionMethods inherited from interface com.tngtech.archunit.library.modules.syntax.ModulesShouldConjunction
andShould
-
Method Details
-
andShould
Description copied from interface:ModulesShouldConjunctionLikeModulesShouldConjunction.andShould(ArchCondition)but offers a fluent API to pick the condition to join.- Specified by:
andShouldin interfaceModulesShouldConjunction<ANNOTATION extends Annotation>
-
as
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> as(String newDescription) Description copied from interface:CanOverrideDescriptionAllows 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:
asin interfaceCanOverrideDescription<ANNOTATION extends Annotation>- Specified by:
asin interfaceModulesRule<ANNOTATION extends Annotation>- Parameters:
newDescription- The description the result of this method will hold- Returns:
- A new equivalent object with adjusted description
-
because
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> because(String reason) - Specified by:
becausein interfaceArchRule- Specified by:
becausein interfaceModulesRule<ANNOTATION extends Annotation>
-
allowEmptyShould
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> allowEmptyShould(boolean allowEmptyShould) Description copied from interface:ArchRuleIf set totrueallows 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 propertyarchRule.failOnEmptyShould.- Specified by:
allowEmptyShouldin interfaceArchRule- Specified by:
allowEmptyShouldin interfaceModulesRule<ANNOTATION extends Annotation>- Parameters:
allowEmptyShould- Whether the rule fails if the should-clause is evaluated with an empty set of elements- Returns:
- A (new)
ArchRulewith adjustedallowEmptyShouldbehavior
-
ignoreDependency
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> ignoreDependency(Class<?> origin, Class<?> target) Description copied from interface:ModulesRuleIgnores all class dependencies from the given origin class to the given target class.
Note that this will always refer to the lastArchConditiononly if multipleArchConditions are joined usingModulesShouldConjunction.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` */)- Specified by:
ignoreDependencyin interfaceModulesRule<ANNOTATION extends Annotation>- Parameters:
origin- the origin class of dependencies to ignoretarget- the target class of dependencies to ignore
-
ignoreDependency
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> ignoreDependency(String originFullyQualifiedClassName, String targetFullyQualifiedClassName) Description copied from interface:ModulesRuleIgnores 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 lastArchConditiononly if multipleArchConditions are joined usingModulesShouldConjunction.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` */)- Specified by:
ignoreDependencyin interfaceModulesRule<ANNOTATION extends Annotation>- Parameters:
originFullyQualifiedClassName- the fully qualified origin class of dependencies to ignoretargetFullyQualifiedClassName- the fully qualified target class of dependencies to ignore
-
ignoreDependency
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> ignoreDependency(Predicate<? super JavaClass> originPredicate, Predicate<? super JavaClass> targetPredicate) Description copied from interface:ModulesRuleIgnores 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 lastArchConditiononly if multipleArchConditions are joined usingModulesShouldConjunction.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` */)- Specified by:
ignoreDependencyin interfaceModulesRule<ANNOTATION extends Annotation>- Parameters:
originPredicate- predicate determining for which origins of dependencies the dependency should be ignoredtargetPredicate- predicate determining for which targets of dependencies the dependency should be ignored
-
ignoreDependency
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) ModulesByAnnotationRule<ANNOTATION> ignoreDependency(Predicate<? super Dependency> dependencyPredicate) Description copied from interface:ModulesRuleIgnores all class dependencies matching the given predicate.
Note that this will always refer to the lastArchConditiononly if multipleArchConditions are joined usingModulesShouldConjunction.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` */)- Specified by:
ignoreDependencyin interfaceModulesRule<ANNOTATION extends Annotation>
-