Class NamedInterface
java.lang.Object
org.springframework.modulith.core.NamedInterface
- All Implemented Interfaces:
Iterable<com.tngtech.archunit.core.domain.JavaClass>
public 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:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionStream<com.tngtech.archunit.core.domain.JavaClass>
Returns aStream
of allJavaClass
es contained in this interface.boolean
contains
(com.tngtech.archunit.core.domain.JavaClass type) Returns whether theNamedInterface
contains the givenJavaClass
.boolean
Returns whether theNamedInterface
contains the given type.getDefaultedNames
(NamedInterface annotation, String packageName) Returns the names declared in the givenNamedInterface
annotation or defaults to the local name of the given package if none declared.getName()
Returns theNamedInterface
's name.(package private) String
getQualifiedName
(ApplicationModuleIdentifier qualifier) (package private) boolean
hasSameNameAs
(NamedInterface other) Returns whether the givenNamedInterface
has the same name as the current one.boolean
isNamed()
Return whether thisNamedInterface
has an explicit name.boolean
Returns whether this is the unnamed (implicit)NamedInterface
.Iterator<com.tngtech.archunit.core.domain.JavaClass>
iterator()
(package private) NamedInterface
merge
(NamedInterface other) Merges the currentNamedInterface
with the givenNamedInterface
.(package private) static NamedInterface
(package private) static List<NamedInterface>
of
(JavaPackage javaPackage) Returns allNamedInterface
s for the givenJavaPackage
.toString()
(package private) static NamedInterface
unnamed
(JavaPackage javaPackage, boolean flatten) Creates an unnamedNamedInterface
for the givenJavaPackage
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
UNNAMED_NAME
- See Also:
-
-
Method Details
-
of
Returns allNamedInterface
s for the givenJavaPackage
.- Parameters:
javaPackage
- must not be null.- Returns:
- will never be null.
-
of
- Parameters:
name
- must not be null or empty.classes
- 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.
-
getQualifiedName
-
isUnnamed
public boolean isUnnamed()Returns whether this is the unnamed (implicit)NamedInterface
. -
isNamed
public boolean isNamed()Return whether thisNamedInterface
has an explicit name. -
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.
-
asJavaClasses
Returns aStream
of allJavaClass
es contained in this interface.- Returns:
- will never be null.
-
hasSameNameAs
Returns whether the givenNamedInterface
has the same name as the current one.- Parameters:
other
- must not be null.
-
iterator
-
merge
Merges the currentNamedInterface
with the givenNamedInterface
.- Parameters:
other
- must not be null.- Returns:
- will never be null.
-
toString
-
getDefaultedNames
Returns the names declared in the givenNamedInterface
annotation or defaults to the local name of the given package if none declared.- Parameters:
annotation
- must not be null.packageName
- must not be null.- Returns:
- will never be null.
-