Package com.tngtech.archunit.lang
Interface ArchRule
-
- All Superinterfaces:
CanBeEvaluated
,CanOverrideDescription<ArchRule>
,HasDescription
- All Known Subinterfaces:
ClassesShouldConjunction
,CodeUnitsShouldConjunction<CODE_UNIT>
,FieldsShouldConjunction
,MembersShouldConjunction<MEMBER>
,MethodsShouldConjunction
- All Known Implementing Classes:
Architectures.LayeredArchitecture
,Architectures.OnionArchitecture
,CompositeArchRule
,FreezingArchRule
,SliceRule
public interface ArchRule extends CanBeEvaluated, CanOverrideDescription<ArchRule>
Represents a rule about a specified set of objects of interest (e.g.JavaClass
). To define a rule, use one of the factory methods withinArchRuleDefinition
, for exampleArchRule rule =
ArchRuleDefinition.noClasses()
.that()
.resideInAPackage("..svc..")
.should()
.accessClassesThat()
.resideInAPackage("..ui..")
; rule.check(importedJavaClasses);
To write rules on custom objects, you can useArchRuleDefinition.all(ClassesTransformer)
, whereClassesTransformer
defines how the type of objects can be created from importedJavaClasses
. E.g. if you want to define a rule on all imported methods you could specify a transformer to retrieve methods from classes, or if you're interested in slices of packages, the input transformer would specify how to transform the imported classes to those slices to run anArchCondition
against.- See Also:
Slices.Transformer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ArchRule.Assertions
static class
ArchRule.Factory
static interface
ArchRule.Transformation
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ArchRule
because(java.lang.String reason)
void
check(JavaClasses classes)
-
Methods inherited from interface com.tngtech.archunit.lang.CanBeEvaluated
evaluate
-
Methods inherited from interface com.tngtech.archunit.core.domain.properties.CanOverrideDescription
as
-
Methods inherited from interface com.tngtech.archunit.base.HasDescription
getDescription
-
-
-
-
Method Detail
-
check
@PublicAPI(usage=ACCESS) void check(JavaClasses classes)
-
because
@PublicAPI(usage=ACCESS) ArchRule because(java.lang.String reason)
-
-