Class ApplicationModule.AllowedDependencies
java.lang.Object
org.springframework.modulith.core.ApplicationModule.AllowedDependencies
- All Implemented Interfaces:
Iterable<ApplicationModule.AllowedDependency>
- Enclosing class:
- ApplicationModule
public static class ApplicationModule.AllowedDependencies
extends Object
implements Iterable<ApplicationModule.AllowedDependency>
A collection wrapper for
ApplicationModule.AllowedDependency instances.- Since:
- 1.4.2, previously package private
- Author:
- Oliver Drotbohm
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newApplicationModule.AllowedDependenciesadding the givenApplicationModule.AllowedDependencyinstance unless they're already present.(package private) static ApplicationModule.AllowedDependenciesclosed(List<ApplicationModule.AllowedDependency> dependencies) Creates anApplicationModule.AllowedDependenciesinstance that only allows the givenApplicationModule.AllowedDependencyinstances.boolean(package private) NamedInterfacesReturns allNamedInterfacestargeted by theApplicationModule.AllowedDependencyinstances.inthashCode()(package private) booleanisAllowedDependency(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis a valid dependency.(package private) booleanisAllowedDependency(Class<?> type) booleanisEmpty()Returns whether we have any allowed dependencies at all.(package private) static booleanReturns whether the given declared dependencies consist of nothing but the open token, i.e. whether the dependencies are not restricted.iterator()(package private) static ApplicationModule.AllowedDependenciesof(ApplicationModule source, String expression, ApplicationModules modules) Creates a new AllowedDependecies from the givenApplicationModuleto the targets defined in the expression.(package private) static ApplicationModule.AllowedDependenciesopen()Creates anApplicationModule.AllowedDependenciesinstance that does not restrict dependencies, i.e. every dependency is considered allowed.(package private) booleanreferTo(ApplicationModule module, NamedInterfaces namedInterfaces) Returns whether theApplicationModule.AllowedDependencyinstances refer to exactly the givenNamedInterfaces of the givenApplicationModule, i.e. there is a dependency for each of them and no dependency refers to anything else.stream()Returns allApplicationModule.AllowedDependencyinstances as aStream.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
isOpen
Returns whether the given declared dependencies consist of nothing but the open token, i.e. whether the dependencies are not restricted.- Parameters:
AllowedDependencies- must not be null.
-
open
Creates anApplicationModule.AllowedDependenciesinstance that does not restrict dependencies, i.e. every dependency is considered allowed. Used for modules that do not declare any allowed dependencies explicitly.- Returns:
- will never be null.
-
closed
static ApplicationModule.AllowedDependencies closed(List<ApplicationModule.AllowedDependency> dependencies) Creates anApplicationModule.AllowedDependenciesinstance that only allows the givenApplicationModule.AllowedDependencyinstances. An emptyListmeans no dependency is allowed at all.- Parameters:
dependencies- must not be null.- Returns:
- will never be null.
-
of
static ApplicationModule.AllowedDependencies of(ApplicationModule source, String expression, ApplicationModules modules) Creates a new AllowedDependecies from the givenApplicationModuleto the targets defined in the expression.- Parameters:
source- the sourceApplicationModule, must not be null.expression- the expression identifying the targets, must not be null or empty.modules- allApplicationModulesavailable, must not be null..- Returns:
- will never be null.
- Since:
- 2.2
-
isEmpty
public boolean isEmpty()Returns whether we have any allowed dependencies at all. -
stream
Returns allApplicationModule.AllowedDependencyinstances as aStream.- Returns:
- will never be null.
-
and
public ApplicationModule.AllowedDependencies and(Iterable<ApplicationModule.AllowedDependency> others) Creates a newApplicationModule.AllowedDependenciesadding the givenApplicationModule.AllowedDependencyinstance unless they're already present.- Parameters:
others- must not be null.- Returns:
- will never be null.
- Since:
- 2.2
-
getTargetNamedInterfaces
NamedInterfaces getTargetNamedInterfaces()Returns allNamedInterfacestargeted by theApplicationModule.AllowedDependencyinstances.- Returns:
- will never be null.
- Since:
- 2.2
-
referTo
Returns whether theApplicationModule.AllowedDependencyinstances refer to exactly the givenNamedInterfaces of the givenApplicationModule, i.e. there is a dependency for each of them and no dependency refers to anything else.- Parameters:
module- must not be null.namedInterfaces- must not be null.- Since:
- 2.2
-
isAllowedDependency
boolean isAllowedDependency(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the givenJavaClassis a valid dependency.- Parameters:
type- must not be null.- Returns:
-
isAllowedDependency
-
iterator
- Specified by:
iteratorin interfaceIterable<ApplicationModule.AllowedDependency>
-
toString
-
equals
-
hashCode
public int hashCode()
-