Class JavaPackage
java.lang.Object
org.springframework.modulith.core.JavaPackage
- All Implemented Interfaces:
com.tngtech.archunit.base.DescribedIterable<com.tngtech.archunit.core.domain.JavaClass>,com.tngtech.archunit.base.HasDescription,Iterable<com.tngtech.archunit.core.domain.JavaClass>
public class JavaPackage
extends Object
implements com.tngtech.archunit.base.DescribedIterable<com.tngtech.archunit.core.domain.JavaClass>
An abstraction of a Java package.
- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tngtech.archunit.base.DescribedIterable
com.tngtech.archunit.base.DescribedIterable.From -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(com.tngtech.archunit.core.domain.JavaClass type) Return whether theJavaPackagecontains the given type.booleanReturns whether theJavaPackagecontains the type with the given name.boolean<A extends Annotation>
Optional<A>getAnnotation(Class<A> annotationType) Return the annotation of the given type declared on the package.Returns all classes residing in the current package and potentially in sub-packages if the current package was created to include them.Returns all direct sub-packages of the current one.Returns the classes exposed by this package, i.e.Returns the local name of the package, i.e.getName()Returns the name of the package.getSubPackagesAnnotatedWith(Class<? extends Annotation> annotation) Returns all sub-packages that carry the given annotation type.inthashCode()static booleanisPackageInfoType(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the given type is thepackage-info.javaone.Iterator<com.tngtech.archunit.core.domain.JavaClass>iterator()static JavaPackageCreates a newJavaPackagefor the given classes and name.Stream<com.tngtech.archunit.core.domain.JavaClass>stream()that(com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> predicate) Returns allClassesthat match the givenDescribedPredicate.toSingle()Reduces theJavaPackageto only its base package.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
-
of
Creates a newJavaPackagefor the given classes and name.- Parameters:
classes- must not be null.name- must not be null or empty.- Returns:
-
isPackageInfoType
public static boolean isPackageInfoType(com.tngtech.archunit.core.domain.JavaClass type) Returns whether the given type is thepackage-info.javaone.- Parameters:
type- must not be null.
-
getName
Returns the name of the package.- Returns:
- will never be null.
-
toSingle
Reduces theJavaPackageto only its base package.- Returns:
- will never be null.
-
getLocalName
Returns the local name of the package, i.e. the last segment of the qualified package name.- Returns:
- will never be null.
-
getDirectSubPackages
Returns all direct sub-packages of the current one.- Returns:
- will never be null.
-
getClasses
Returns all classes residing in the current package and potentially in sub-packages if the current package was created to include them.- Returns:
- will never be null.
-
getExposedClasses
Returns the classes exposed by this package, i.e. only public ones. Also filters thepackage-infotype.- Returns:
- will never be null.
-
getSubPackagesAnnotatedWith
Returns all sub-packages that carry the given annotation type.- Parameters:
annotation- must not be null.- Returns:
- will never be null.
-
that
public Classes that(com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaClass> predicate) Returns allClassesthat match the givenDescribedPredicate.- Parameters:
predicate- must not be null.- Returns:
-
contains
public boolean contains(com.tngtech.archunit.core.domain.JavaClass type) Return whether theJavaPackagecontains the given type.- Parameters:
type- must not be null.
-
contains
Returns whether theJavaPackagecontains the type with the given name.- Parameters:
typeName- must not be null or empty.
-
stream
- Returns:
- will never be null.
-
getAnnotation
Return the annotation of the given type declared on the package.- Type Parameters:
A- the annotation type.- Parameters:
annotationType- the annotation type to be found.- Returns:
- will never be null.
-
getDescription
- Specified by:
getDescriptionin interfacecom.tngtech.archunit.base.HasDescription
-
iterator
-
toString
-
equals
-
hashCode
public int hashCode()
-