Class ApplicationModules
java.lang.Object
org.springframework.modulith.core.ApplicationModules
- All Implemented Interfaces:
Iterable<ApplicationModule>
- Author:
- Oliver Drotbohm, Peter Gafert
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedApplicationModules(ModulithMetadata metadata, Collection<String> packages, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored, boolean useFullyQualifiedModuleNames, com.tngtech.archunit.core.importer.ImportOption option) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis contained within theApplicationModules.Executes all verifications to be applied and returnsViolationsif any occured.Returns aComparatorthat will sort objects based on their types' application module.getModuleByName(String name) Returns theApplicationModulewith the given name.getModuleByType(com.tngtech.archunit.core.domain.JavaClass type) Returns the module that contains the givenJavaClass.getModuleByType(Class<?> candidate) Returns theApplicationModulecontaining the given type.getModuleByType(String candidate) Returns theApplicationModulecontaining the type with the given simple or fully-qualified name.getModuleForPackage(String name) Deprecated, for removal: This API element is subject to removal in a future version.Returns allApplicationModules registered as shared ones.Returns the source of theApplicationModules.Returns the system name if defined.iterator()static ApplicationModulesCreates a newApplicationModulesrelative to the given modulith type.static ApplicationModulesof(Class<?> modulithType, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesrelative to the given modulith type, aApplicationModuleDetectionStrategyand aDescribedPredicatewhich types and packages to ignore.static ApplicationModulesCreates a newApplicationModulesinstance for the given package name.static ApplicationModulesof(String javaPackage, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesinstance for the given package name and ignored classes.stream()Returns allApplicationModules.toString()verify()Execute all verifications to be applied, unless the verification has been executed before.booleanwithinRootPackages(String className) Returns whether the given type is contained in one of the root packages (not including sub-packages) of the modules.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ApplicationModules
protected ApplicationModules(ModulithMetadata metadata, Collection<String> packages, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored, boolean useFullyQualifiedModuleNames, com.tngtech.archunit.core.importer.ImportOption option)
-
-
Method Details
-
of
Creates a newApplicationModulesrelative to the given modulith type. Will inspect theModulithannotation on the class given for advanced customizations of the module setup.- Parameters:
modulithType- must not be null.- Returns:
- will never be null.
-
of
public static ApplicationModules of(Class<?> modulithType, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesrelative to the given modulith type, aApplicationModuleDetectionStrategyand aDescribedPredicatewhich types and packages to ignore. Will inspect theModulithandModulithicannotations on the class given for advanced customizations of the module setup.- Parameters:
modulithType- must not be null.ignored- must not be null.- Returns:
- will never be null.
-
of
Creates a newApplicationModulesinstance for the given package name.- Parameters:
javaPackage- must not be null or empty.- Returns:
- will never be null.
-
of
public static ApplicationModules of(String javaPackage, com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesinstance for the given package name and ignored classes.- Parameters:
javaPackage- must not be null or empty.ignored- must not be null.- Returns:
- will never be null.
-
getModulithSource
Deprecated, for removal: This API element is subject to removal in a future version.usegetSource()insteadReturns the source of theApplicationModules. Either a main application class or a package name.- Returns:
- will never be null.
-
getSource
Returns the source of theApplicationModules. Either a main application class or a package name.- Returns:
- will never be null.
-
contains
public boolean contains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis contained within theApplicationModules.- Parameters:
type- must not be null.- Returns:
-
withinRootPackages
Returns whether the given type is contained in one of the root packages (not including sub-packages) of the modules.- Parameters:
className- must not be null or empty.- Returns:
-
getModuleByName
Returns theApplicationModulewith the given name.- Parameters:
name- must not be null or empty.- Returns:
-
getModuleByType
Returns the module that contains the givenJavaClass.- Parameters:
type- must not be null.- Returns:
-
getModuleByType
Returns theApplicationModulecontaining the type with the given simple or fully-qualified name.- Parameters:
candidate- must not be null or empty.- Returns:
- will never be null.
-
getModuleByType
Returns theApplicationModulecontaining the given type.- Parameters:
candidate- must not be null.- Returns:
- will never be null.
-
getModuleForPackage
-
verify
Execute all verifications to be applied, unless the verification has been executed before.- Returns:
- will never be null.
-
detectViolations
Executes all verifications to be applied and returnsViolationsif any occured. Will always execute the verifications in contrast toverify()which just runs once.- Returns:
- will never be null.
- See Also:
-
stream
Returns allApplicationModules.- Returns:
- will never be null.
-
getSystemName
Returns the system name if defined.- Returns:
-
getComparator
Returns aComparatorthat will sort objects based on their types' application module. In other words, objects of types in more fundamental modules will be ordered before ones residing in downstream modules. For example, if module A depends on B, objects of types residing in B will be ordered before ones in A. For objects residing in the same module, standard Spring-based ordering (viaOrderorOrdered) will be applied.- Returns:
- will never be null.
-
iterator
- Specified by:
iteratorin interfaceIterable<ApplicationModule>
-
toString
-
getSource()instead