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
Fields -
Method Summary
Modifier and TypeMethodDescriptionStream<com.tngtech.archunit.core.domain.JavaClass>Returns aStreamof allJavaClasses contained in this interface.booleancontains(com.tngtech.archunit.core.domain.JavaClass type) Returns whether theNamedInterfacecontains the givenJavaClass.booleanReturns whether theNamedInterfacecontains the given type.getDefaultedNames(NamedInterface annotation, String packageName) Returns the names declared in the givenNamedInterfaceannotation or defaults to the local name of the given package if none declared.getName()Returns theNamedInterface's name.(package private) StringgetQualifiedName(ApplicationModuleIdentifier qualifier) (package private) booleanhasSameNameAs(NamedInterface other) Returns whether the givenNamedInterfacehas the same name as the current one.booleanisNamed()Return whether thisNamedInterfacehas an explicit name.booleanReturns whether this is the unnamed (implicit)NamedInterface.Iterator<com.tngtech.archunit.core.domain.JavaClass>iterator()(package private) NamedInterfacemerge(NamedInterface other) Merges the currentNamedInterfacewith the givenNamedInterface.(package private) static NamedInterface(package private) static List<NamedInterface>of(JavaPackage javaPackage) Returns allNamedInterfaces for the givenJavaPackage.toString()(package private) static NamedInterfaceunnamed(JavaPackage javaPackage, boolean flatten) Creates an unnamedNamedInterfacefor the givenJavaPackage.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
-
Field Details
-
UNNAMED_NAME
- See Also:
-
-
Method Details
-
of
Returns allNamedInterfaces 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 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.
-
getQualifiedName
-
isUnnamed
public boolean isUnnamed()Returns whether this is the unnamed (implicit)NamedInterface. -
isNamed
public boolean isNamed()Return whether thisNamedInterfacehas an explicit name. -
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.
-
asJavaClasses
Returns aStreamof allJavaClasses contained in this interface.- Returns:
- will never be null.
-
hasSameNameAs
Returns whether the givenNamedInterfacehas the same name as the current one.- Parameters:
other- must not be null.
-
iterator
-
merge
Merges the currentNamedInterfacewith the givenNamedInterface.- Parameters:
other- must not be null.- Returns:
- will never be null.
-
toString
-
getDefaultedNames
Returns the names declared in the givenNamedInterfaceannotation 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.
-