16
16
package com .tngtech .archunit .library .dependencies ;
17
17
18
18
import com .tngtech .archunit .PublicAPI ;
19
+ import com .tngtech .archunit .core .domain .PackageMatcher ;
19
20
import com .tngtech .archunit .lang .ArchRule ;
20
21
import com .tngtech .archunit .lang .Priority ;
21
22
import com .tngtech .archunit .library .dependencies .syntax .GivenSlices ;
24
25
import static com .tngtech .archunit .PublicAPI .Usage .ACCESS ;
25
26
26
27
/**
27
- * Allows to specify {@link ArchRule ArchRules} for "slices" of a code base. A slice is conceptually
28
- * a cut through a code base according to business logic. Take for example
28
+ * Allows to specify {@link ArchRule ArchRules} for "slices" of a code base.
29
+ * A slice is conceptually a cut through a code base according to business logic.
30
+ * <h6>Example</h6>
29
31
* <pre><code>
30
32
* com.mycompany.myapp.order
31
33
* com.mycompany.myapp.customer
32
34
* com.mycompany.myapp.user
33
35
* com.mycompany.myapp.authorization
34
36
* </code></pre>
35
- * The top level packages under 'myapp' are composed according to different domain aspects. It is
36
- * good practice, to keep such packages free of cycles, which is one capability that this class
37
- * provides.<br>
38
- * Consider
39
- * <pre><code>
40
- * {@link #slices() slices()}.{@link Slices#matching(String) matching("..myapp.(*)..")}.{@link GivenSlices#should() should()}.{@link SlicesShould#beFreeOfCycles() beFreeOfCycles()}
41
- * </code></pre>
42
- * Then this rule will assert, that the four slices of 'myapp' are free of cycles.
37
+ * The top level packages under {@code myapp} are composed according to different domain aspects.
38
+ * It is good practice to keep such packages free of cycles,
39
+ * which can be tested with the following rule:
40
+ * <pre><code>{@link #slices() slices()}.{@link Creator#matching(String) matching("..myapp.(*)..")}.{@link GivenSlices#should() should()}.{@link SlicesShould#beFreeOfCycles() beFreeOfCycles()}</code></pre>
41
+ * This rule asserts that the four slices of {@code myapp} are free of cycles.
43
42
*/
44
43
@ PublicAPI (usage = ACCESS )
45
44
public final class SlicesRuleDefinition {
@@ -60,6 +59,8 @@ private Creator() {
60
59
}
61
60
62
61
/**
62
+ * defines a {@link SlicesRuleDefinition "slices" rule}
63
+ * based on a {@link PackageMatcher package identifier} with capturing groups
63
64
* @see Slices#matching(String)
64
65
*/
65
66
@ PublicAPI (usage = ACCESS )
@@ -68,6 +69,8 @@ public GivenSlices matching(String packageIdentifier) {
68
69
}
69
70
70
71
/**
72
+ * defines a {@link SlicesRuleDefinition "slices" rule}
73
+ * based on a {@link PackageMatcher package identifier} with capturing groups
71
74
* @see Slices#matching(String)
72
75
*/
73
76
@ PublicAPI (usage = ACCESS )
@@ -76,6 +79,8 @@ public GivenSlices matching(String packageIdentifier, Priority priority) {
76
79
}
77
80
78
81
/**
82
+ * defines a {@link SlicesRuleDefinition "slices" rule}
83
+ * based on an explicit {@link SliceAssignment}
79
84
* @see Slices#assignedFrom(SliceAssignment)
80
85
*/
81
86
@ PublicAPI (usage = ACCESS )
@@ -84,6 +89,8 @@ public GivenSlices assignedFrom(SliceAssignment assignment) {
84
89
}
85
90
86
91
/**
92
+ * defines a {@link SlicesRuleDefinition "slices" rule}
93
+ * based on an explicit {@link SliceAssignment}
87
94
* @see Slices#assignedFrom(SliceAssignment)
88
95
*/
89
96
@ PublicAPI (usage = ACCESS )
0 commit comments