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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNamedInterface(String name) Creates a newNamedInterfacewith the given name. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether theNamedInterfacecontains the givenJavaClass.booleanReturns whether theNamedInterfacecontains the given type.protected abstract ClassesReturns allClassesmaking up thisNamedInterface.getName()Returns theNamedInterface's name.(package private) booleanhasSameNameAs(NamedInterface other) Returns whether the givenNamedInterfacehas the same name as the current one.booleanReturns whether this is the unnamed (implicit)NamedInterface.Iterator<com.tngtech.archunit.core.domain.JavaClass>iterator()abstract NamedInterfaceMerges the currentNamedInterfacewith the givenNamedInterface.TypeBasedNamedInterface.of(String name, Classes classes, JavaPackage basePackage) static List<NamedInterface>of(JavaPackage javaPackage) Returns allNamedInterface.PackageBasedNamedInterfaces for the givenJavaPackage.(package private) static NamedInterfaceunnamed(JavaPackage javaPackage) Creates an unnamedNamedInterfacefor the givenJavaPackage.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
name
-
-
Constructor Details
-
NamedInterface
Creates a newNamedInterfacewith the given name.- Parameters:
name- must not be null or empty.
-
-
Method Details
-
of
Returns allNamedInterface.PackageBasedNamedInterfaces 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 unnamedNamedInterfacefor 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 theNamedInterfacecontains the givenJavaClass.- Parameters:
type- must not be null.
-
contains
Returns whether theNamedInterfacecontains the given type.- Parameters:
type- must not be null.
-
hasSameNameAs
Returns whether the givenNamedInterfacehas the same name as the current one.- Parameters:
other- must not be null.
-
iterator
-
getClasses
Returns allClassesmaking up thisNamedInterface.- Returns:
- will never be null.
-
merge
Merges the currentNamedInterfacewith the givenNamedInterface.TypeBasedNamedInterface.- Parameters:
other- must not be null.- Returns:
- will never be null.
-