Class NamedInterface
java.lang.Object
org.springframework.modulith.core.NamedInterface
- All Implemented Interfaces:
Iterable<com.tngtech.archunit.core.domain.JavaClass>
- Direct Known Subclasses:
NamedInterface.TypeBasedNamedInterface
public abstract class NamedInterface
extends Object
implements Iterable<com.tngtech.archunit.core.domain.JavaClass>
A named interface into an
ApplicationModule
. This can either be a package, explicitly annotated with
NamedInterface
or a set of types annotated with the same annotation. Other
ApplicationModules
can define allowed dependencies to particular named interfaces via the
$moduleName::$namedInterfaceName
syntax.- Author:
- Oliver Drotbohm
- See Also:
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
NamedInterface
(String name) Creates a newNamedInterface
with the given name. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(com.tngtech.archunit.core.domain.JavaClass type) Returns whether theNamedInterface
contains the givenJavaClass
.boolean
Returns whether theNamedInterface
contains the given type.protected abstract Classes
Returns allClasses
making up thisNamedInterface
.getName()
Returns theNamedInterface
's name.(package private) boolean
hasSameNameAs
(NamedInterface other) Returns whether the givenNamedInterface
has the same name as the current one.boolean
Returns whether this is the unnamed (implicit)NamedInterface
.Iterator<com.tngtech.archunit.core.domain.JavaClass>
iterator()
abstract NamedInterface
Merges the currentNamedInterface
with the givenNamedInterface.TypeBasedNamedInterface
.of
(String name, Classes classes, JavaPackage basePackage) static List<NamedInterface>
of
(JavaPackage javaPackage) Returns allNamedInterface.PackageBasedNamedInterface
s for the givenJavaPackage
.(package private) static NamedInterface
unnamed
(JavaPackage javaPackage) Creates an unnamedNamedInterface
for the givenJavaPackage
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
name
-
-
Constructor Details
-
NamedInterface
Creates a newNamedInterface
with the given name.- Parameters:
name
- must not be null or empty.
-
-
Method Details
-
of
Returns allNamedInterface.PackageBasedNamedInterface
s for the givenJavaPackage
.- Parameters:
javaPackage
- must not be null.- Returns:
- will never be null.
-
of
public static NamedInterface.TypeBasedNamedInterface of(String name, Classes classes, JavaPackage basePackage) - Parameters:
name
- must not be null or empty.classes
- must not be null.basePackage
- must not be null.- Returns:
- will never be null.
-
unnamed
Creates an unnamedNamedInterface
for the givenJavaPackage
.- Parameters:
javaPackage
- must not be null.- Returns:
- will never be null.
-
getName
Returns theNamedInterface
's name.- Returns:
- will never be null or empty.
-
isUnnamed
public boolean isUnnamed()Returns whether this is the unnamed (implicit)NamedInterface
. -
contains
public boolean contains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether theNamedInterface
contains the givenJavaClass
.- Parameters:
type
- must not be null.
-
contains
Returns whether theNamedInterface
contains the given type.- Parameters:
type
- must not be null.
-
hasSameNameAs
Returns whether the givenNamedInterface
has the same name as the current one.- Parameters:
other
- must not be null.
-
iterator
-
getClasses
Returns allClasses
making up thisNamedInterface
.- Returns:
- will never be null.
-
merge
Merges the currentNamedInterface
with the givenNamedInterface.TypeBasedNamedInterface
.- Parameters:
other
- must not be null.- Returns:
- will never be null.
-