Class JavaPackages
java.lang.Object
org.springframework.modulith.core.JavaPackages
- All Implemented Interfaces:
Iterable<JavaPackage>
A collection of
JavaPackages.- Since:
- 1.3, public since 1.4.6, 2.0.1
- Author:
- Oliver Drotbohm
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJavaPackages(Collection<JavaPackage> packages) Creates a newJavaPackagesinstance for the givenJavaPackages.JavaPackages(JavaPackage... packages) Creates a newJavaPackagesinstance for the givenJavaPackages. -
Method Summary
Modifier and TypeMethodDescription(package private) booleanReturns whether any of the packages contains the given type.booleancontains(JavaPackage pkg) booleancouldContain(Class<?> type) Returns whether any of the the packages could contain the type independent of the actual types backing the current instance.booleancouldContain(String type) Returns whether any of the the packages could contain the type independent of the actual types backing the current instance.(package private) JavaPackagesflatten()Returns aJavaPackagesinstance that only contains the primary packages contained in the currentJavaPackages.(package private) JavaPackagesReturns allJavaPackagesthat are a sub-package of the given one.iterator()stream()Returns a stream ofJavaPackages.toString()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
-
NONE
-
-
Constructor Details
-
JavaPackages
Creates a newJavaPackagesinstance for the givenJavaPackages.- Parameters:
packages- must not be null.
-
JavaPackages
JavaPackages(JavaPackage... packages) Creates a newJavaPackagesinstance for the givenJavaPackages.- Parameters:
packages- must not be null.
-
-
Method Details
-
flatten
JavaPackages flatten()Returns aJavaPackagesinstance that only contains the primary packages contained in the currentJavaPackages. Any package that's a sub-package of any other package will get dropped.In other words for a list of {code com.foo},
com.bar, andcom.foo.bar, onlycom.fooandcom.barwill be retained.- Returns:
- will never be null.
-
stream
Returns a stream ofJavaPackages.- Returns:
- will never be null.
-
getSubPackagesOf
Returns allJavaPackagesthat are a sub-package of the given one.- Parameters:
pkg- must not be null.- Returns:
- will never be null.
- Since:
- 1.4.2
-
contains
-
contains
Returns whether any of the packages contains the given type.- Parameters:
type- must not be null.- Since:
- 1.4.6, 2.0.1
-
couldContain
Returns whether any of the the packages could contain the type independent of the actual types backing the current instance.- Parameters:
type- must not be null.- Since:
- 1.4.6, 2.0.1
- See Also:
-
couldContain
Returns whether any of the the packages could contain the type independent of the actual types backing the current instance.- Parameters:
type- must not be null.- Since:
- 1.4.6, 2.0.1
- See Also:
-
iterator
- Specified by:
iteratorin interfaceIterable<JavaPackage>
-
toString
-