Class JavaPackages
java.lang.Object
org.springframework.modulith.core.JavaPackages
- All Implemented Interfaces:
Iterable<JavaPackage>
A collection of
JavaPackage
s.- Since:
- 1.3
- Author:
- Oliver Drotbohm
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJavaPackages
(Collection<JavaPackage> packages) Creates a newJavaPackages
instance for the givenJavaPackage
s.JavaPackages
(JavaPackage... packages) Creates a newJavaPackages
instance for the givenJavaPackage
s. -
Method Summary
Modifier and TypeMethodDescription(package private) JavaPackages
flatten()
Returns aJavaPackages
instance that only contains the primary packages contained in the currentJavaPackages
.(package private) JavaPackages
Returns allJavaPackages
that are a sub-package of the given one.iterator()
(package private) Stream<JavaPackage>
stream()
Returns a stream ofJavaPackage
s.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
NONE
-
-
Constructor Details
-
JavaPackages
JavaPackages(Collection<JavaPackage> packages) Creates a newJavaPackages
instance for the givenJavaPackage
s.- Parameters:
packages
- must not be null.
-
JavaPackages
JavaPackages(JavaPackage... packages) Creates a newJavaPackages
instance for the givenJavaPackage
s.- Parameters:
packages
- must not be null.
-
-
Method Details
-
flatten
JavaPackages flatten()Returns aJavaPackages
instance 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.foo
andcom.bar
will be retained.- Returns:
- will never be null.
-
stream
Stream<JavaPackage> stream()Returns a stream ofJavaPackage
s.- Returns:
- will never be null.
-
getSubPackagesOf
Returns allJavaPackages
that 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:
iterator
in interfaceIterable<JavaPackage>
-
toString
-