Class JavaPackages
java.lang.Object
org.springframework.modulith.core.JavaPackages
- All Implemented Interfaces:
Iterable<JavaPackage>
A collection of
JavaPackages.- Since:
- 1.3
- 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) 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()(package private) Stream<JavaPackage>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
JavaPackages(Collection<JavaPackage> packages) 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
Stream<JavaPackage> 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
-
iterator
- Specified by:
iteratorin interfaceIterable<JavaPackage>
-
toString
-