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, com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> ignored, com.tngtech.archunit.core.importer.ImportOption option) Creates a newApplicationModulesinstance.protectedApplicationModules(ModulithMetadata metadata, Collection<String> packages, com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> ignored, boolean useFullyQualifiedModuleNames, com.tngtech.archunit.core.importer.ImportOption option) Deprecated, for removal: This API element is subject to removal in a future version.since 1.2, for removal in 1.3. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis contained within theApplicationModules.booleanReturns whether the givenClassis contained within theApplicationModules.Executes all verifications to be applied and returnsViolationsif any occured.detectViolations(VerificationOptions options) Executes all verifications to be applied considering the givenVerificationOptionsand 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) Returns theApplicationModulecontaining the given package.Deprecated, for removal: This API element is subject to removal in a future version.usegetSource()insteadgetNestedModules(ApplicationModule module) Returns all nested modules of the givenApplicationModule.getParentOf(ApplicationModule module) Returns the parentApplicationModuleif the given one has one.Returns all root packages.Returns allApplicationModules registered as shared ones.Returns the source of theApplicationModules.Returns the system name if defined.booleanhasParent(ApplicationModule module) Returns whether the givenApplicationModulehas a parent one.iterator()static ApplicationModulesCreates a newApplicationModulesrelative to the given modulith type.static ApplicationModulesof(Class<?> modulithType, com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesrelative to the given modulith type, and aDescribedPredicatewhich types and packages to ignore.static ApplicationModulesCreates a newApplicationModulesinstance for the given type andImportOption.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.static ApplicationModulesCreates a newApplicationModulesinstance for the given package andImportOption.stream()Returns allApplicationModules.toString()verify()Execute all verifications to be applied, unless the verification has been executed before.verify(VerificationOptions options) Execute all verifications to be applied considering the givenVerificationOptions, 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, com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> ignored, com.tngtech.archunit.core.importer.ImportOption option) Creates a newApplicationModulesinstance.- Parameters:
metadata- must not be null.ignored- must not be null.option- must not be null.
-
ApplicationModules
@Deprecated(forRemoval=true) protected ApplicationModules(ModulithMetadata metadata, Collection<String> packages, com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> ignored, boolean useFullyQualifiedModuleNames, com.tngtech.archunit.core.importer.ImportOption option) Deprecated, for removal: This API element is subject to removal in a future version.since 1.2, for removal in 1.3. UseApplicationModules(org.springframework.modulith.core.ModulithMetadata,com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass>,com.tngtech.archunit.core.importer.ImportOption)instead and set upModulithMetadatato contain the packages you want to use.Creates a newApplicationModulesinstance.- Parameters:
metadata- must not be null.packages- must not be null.ignored- must not be null.useFullyQualifiedModuleNames- can be null.option- must not be null.
-
-
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<? super com.tngtech.archunit.core.domain.JavaClass> ignored) Creates a newApplicationModulesrelative to the given modulith type, and 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
public static ApplicationModules of(Class<?> modulithType, com.tngtech.archunit.core.importer.ImportOption options) Creates a newApplicationModulesinstance for the given type andImportOption.- Parameters:
modulithType- must not be null.options- must not be null.- Returns:
- will never be null.
- Since:
- 1.2
-
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.
-
of
public static ApplicationModules of(String javaPackage, com.tngtech.archunit.core.importer.ImportOption options) Creates a newApplicationModulesinstance for the given package andImportOption.- Parameters:
javaPackage- must not be null.options- must not be null.- Returns:
- will never be null.
- Since:
- 1.2
-
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.
-
getRootPackages
Returns all root packages.- Returns:
- will never be null.
- Since:
- 1.4
-
contains
public boolean contains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis contained within theApplicationModules.- Parameters:
type- must not be null.
-
contains
Returns whether the givenClassis contained within theApplicationModules.- Parameters:
type- must not be null.
-
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.
-
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
Returns theApplicationModulecontaining the given package.- Parameters:
name- must not be null or empty.- Returns:
- will never be null.
-
verify
Execute all verifications to be applied, unless the verification has been executed before.- Returns:
- will never be null.
-
verify
Execute all verifications to be applied considering the givenVerificationOptions, unless the verification has been executed before.- Returns:
- will never be null.
- Since:
- 1.4
-
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:
-
detectViolations
Executes all verifications to be applied considering the givenVerificationOptionsand returnsViolationsif any occured. Will always execute the verifications in contrast toverify()which just runs once.- Returns:
- will never be null.
- Since:
- 1.4
- 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.
-
getParentOf
Returns the parentApplicationModuleif the given one has one.- Parameters:
module- must not be null.- Returns:
- will never be null.
- Since:
- 1.3
-
hasParent
Returns whether the givenApplicationModulehas a parent one.- Parameters:
module- must not be null.- Since:
- 1.3
-
getNestedModules
Returns all nested modules of the givenApplicationModule.- Parameters:
module- must not be null.- Returns:
- will never be null.
- Since:
- 1.4.2
-
iterator
- Specified by:
iteratorin interfaceIterable<ApplicationModule>
-
toString
-