|
21 | 21 |
|
22 | 22 | public class ContextMapperArchConditions {
|
23 | 23 |
|
| 24 | + private ContextMapperArchConditions() { |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Checks whether a class, given by its simple name, is represented as an Aggregate in CML. |
| 29 | + * |
| 30 | + * @param cmlContext the CML Bounded Context within which the check searches for the Aggregates |
| 31 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 32 | + */ |
24 | 33 | public static ModeledAsAggregateInContext beModeledAsAggregatesInCML(BoundedContext cmlContext) {
|
25 | 34 | return ModeledAsAggregateInContext.beModeledAsAggregatesInCML(cmlContext);
|
26 | 35 | }
|
27 | 36 |
|
| 37 | + /** |
| 38 | + * Checks whether a class, given by its simple name, is represented as an Entity in CML. |
| 39 | + * |
| 40 | + * @param cmlContext the CML Bounded Context within which the check searches for the Entities |
| 41 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 42 | + */ |
28 | 43 | public static ModeledAsEntityInContext beModeledAsEntityInCML(BoundedContext cmlContext) {
|
29 | 44 | return ModeledAsEntityInContext.beModeledAsEntityInCML(cmlContext);
|
30 | 45 | }
|
31 | 46 |
|
| 47 | + /** |
| 48 | + * Checks whether a class, given by its simple name, is represented as a Value Object in CML. |
| 49 | + * |
| 50 | + * @param cmlContext the CML Bounded Context within which the check searches for the Value Objects |
| 51 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 52 | + */ |
32 | 53 | public static ModeledAsValueObjectInContext beModeledAsValueObjectInCML(BoundedContext cmlContext) {
|
33 | 54 | return ModeledAsValueObjectInContext.beModeledAsValueObjectInCML(cmlContext);
|
34 | 55 | }
|
35 | 56 |
|
| 57 | + /** |
| 58 | + * Checks whether a module (a package-info.java class with an @Module jMolecules annotation that sets the module name) |
| 59 | + * is represented as a corresponding module in CML. |
| 60 | + * <p> |
| 61 | + * Limitation: this rule works with the jMolecules annotation only! |
| 62 | + * |
| 63 | + * @param cmlContext the CML Bounded Context within which the check searches for the Module |
| 64 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 65 | + */ |
36 | 66 | public static ModeledAsModuleInContext beModeledAsModulesInCML(BoundedContext cmlContext) {
|
37 | 67 | return ModeledAsModuleInContext.beModeledAsModulesInCML(cmlContext);
|
38 | 68 | }
|
39 | 69 |
|
| 70 | + /** |
| 71 | + * Checks whether a class, given by its simple name, is represented as a Domain Event in CML. |
| 72 | + * |
| 73 | + * @param cmlContext the CML Bounded Context within which the check searches for the Domain Events |
| 74 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 75 | + */ |
40 | 76 | public static ModeledAsDomainEventInContext beModeledAsDomainEventInCML(BoundedContext cmlContext) {
|
41 | 77 | return ModeledAsDomainEventInContext.beModeledAsDomainEventInCML(cmlContext);
|
42 | 78 | }
|
43 | 79 |
|
| 80 | + /** |
| 81 | + * Checks whether a class, given by its simple name, is represented as a service in CML. |
| 82 | + * |
| 83 | + * @param cmlContext the CML Bounded Context within which the check searches for the services |
| 84 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 85 | + */ |
44 | 86 | public static ModeledAsServiceInContext beModeledAsServiceInCML(BoundedContext cmlContext) {
|
45 | 87 | return ModeledAsServiceInContext.beModeledAsServiceInCML(cmlContext);
|
46 | 88 | }
|
47 | 89 |
|
| 90 | + /** |
| 91 | + * Checks whether a class, given by its simple name, is represented as a repository in CML. |
| 92 | + * |
| 93 | + * @param boundedContext the CML Bounded Context within which the check searches for the repositories |
| 94 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 95 | + */ |
48 | 96 | public static ModeledAsRepositoryInContext beModeledAsRepositoryInCML(BoundedContext boundedContext) {
|
49 | 97 | return ModeledAsRepositoryInContext.beModeledAsRepositoryInCML(boundedContext);
|
50 | 98 | }
|
51 | 99 |
|
| 100 | + /** |
| 101 | + * Checks whether an Java package representing an Aggregate, contains the same objects (Entities, Value Objects, Domain Events) |
| 102 | + * as the corresponding Aggregate in CML. |
| 103 | + * |
| 104 | + * @param boundedContext the CML Bounded Context within which the check searches for the Aggregates |
| 105 | + * @param tacticDDDAnnotationSet the set of Java annotations that is used to identify entities, value objects, and domain events within |
| 106 | + * the package. Provide an implementation of the {@link TacticDDDAnnotationSet} interface ( |
| 107 | + * custom or, for example, {@link org.contextmapper.archunit.annotations.JMoleculesTacticAnnotationSet}). |
| 108 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaPackage} |
| 109 | + */ |
52 | 110 | public static AdhereToCmlAggregateStructure adhereToCmlAggregateStructure(BoundedContext boundedContext,
|
53 | 111 | TacticDDDAnnotationSet tacticDDDAnnotationSet) {
|
54 | 112 | return AdhereToCmlAggregateStructure.adhereToCmlAggregateStructure(boundedContext, tacticDDDAnnotationSet);
|
55 | 113 | }
|
56 | 114 |
|
| 115 | + /** |
| 116 | + * Checks whether a classes fields are modeled in a CML entity. |
| 117 | + * |
| 118 | + * @param boundedContext the CML Bounded Context within which the check searches for the corresponding entities (by the classes simple names) |
| 119 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 120 | + */ |
| 121 | + public static AdhereToCmlEntityStructure adhereToCmlEntityStructure(BoundedContext boundedContext) { |
| 122 | + return AdhereToCmlEntityStructure.adhereToCmlEntityStructure(boundedContext); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Checks whether a classes fields are modeled in a CML value object. |
| 127 | + * |
| 128 | + * @param boundedContext the CML Bounded Context within which the check searches for the corresponding value objects (by the classes simple names) |
| 129 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 130 | + */ |
| 131 | + public static AdhereToCmlValueObjectStructure adhereToCmlValueObjectStructure(BoundedContext boundedContext) { |
| 132 | + return AdhereToCmlValueObjectStructure.adhereToCmlValueObjectStructure(boundedContext); |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * Checks whether a classes fields are modeled in a CML domain event. |
| 137 | + * |
| 138 | + * @param boundedContext the CML Bounded Context within which the check searches for the corresponding domain events (by the classes simple names) |
| 139 | + * @return returns an {@link com.tngtech.archunit.lang.ArchCondition} for a {@link com.tngtech.archunit.core.domain.JavaClass} |
| 140 | + */ |
| 141 | + public static AdhereToCmlDomainEventStructure adhereToCmlDomainEventStructure(BoundedContext boundedContext) { |
| 142 | + return AdhereToCmlDomainEventStructure.adhereToCmlDomainEventStructure(boundedContext); |
| 143 | + } |
| 144 | + |
57 | 145 | }
|
0 commit comments