ArchitectureModuleRules

A library of architecture tests to ensure correct layering and usage of packages.

API

ArchitectureModuleRules.java
class ArchitectureModuleRules {
  List<Class<?>> analyzeClasses_packagesOf(Class<?> clazz)     (1)
  Architectures.LayeredArchitecture code_dependencies_follow_module_Imports(List<Class<?>> moduleClasses)     (2)
  Architectures.LayeredArchitecture code_dependencies_follow_module_Imports_and_subpackage_rules(List<Class<?>> moduleClasses, List<Subpackage> subpackages)     (3)
  String nameOf(Class<?> moduleClass, String subpackageName)
  String[] namesOf(Class<?> moduleClass, String... subpackageNames)
  String[] namesOf(Set<Class<?>> importingClasses, String... subpackageNames)
  String packageIdentifierFor(Class<?> moduleClass)
  String packageIdentifierFor(Class<?> moduleClass, Subpackage subpackage)
  String[] both(String str, String[] arr)
  String[] both(String[] arr1, String[] arr2)
  Map<T, Set<T>> invert(Map<T, Set<T>> valueSetByKey)
  void accumulateTransitiveDependencies(Class<?> referringClass, Map<Class<?>, Set<Class<?>>> directDependenciesByReferringClass, Set<Class<?>> transitiveDependenciesOfReferringClass)
}
1 analyzeClasses_packagesOf(Class)

Utility method to aggregate the module classes (named "XxxModule") that are extracted from the AnalyzeClasses annotation on the provided class.

2 code_dependencies_follow_module_Imports(List)

Ensures that the actual dependencies between classes within modules honour the module dependency graph inferred from the Import statements of each module.

3 code_dependencies_follow_module_Imports_and_subpackage_rules(List, List)

Ensures that the actual dependencies between classes within modules honour the module dependency graph inferred from the Import statements of each module AND also ensures that the subpackages within those rules only access the allowed subpackages of both their own &local;local&local; and the subpackages of other modules that they might reference.

Members

analyzeClasses_packagesOf(Class)

Utility method to aggregate the module classes (named "XxxModule") that are extracted from the AnalyzeClasses annotation on the provided class.

The result is intended to be passed into #code_dependencies_follow_module_Imports(List) and #code_dependencies_follow_module_Imports_and_subpackage_rules(List, List) .

code_dependencies_follow_module_Imports(List)

Ensures that the actual dependencies between classes within modules honour the module dependency graph inferred from the Import statements of each module.

code_dependencies_follow_module_Imports_and_subpackage_rules(List, List)

Ensures that the actual dependencies between classes within modules honour the module dependency graph inferred from the Import statements of each module AND also ensures that the subpackages within those rules only access the allowed subpackages of both their own &local;local&local; and the subpackages of other modules that they might reference.