Record Class ApplicationModuleSource
java.lang.Object
java.lang.Record
org.springframework.modulith.core.ApplicationModuleSource
The source of an
ApplicationModule
. Essentially a JavaPackage
and associated naming strategy for the
module. This will be used when constructing sources from a base package and an
ApplicationModuleDetectionStrategy
so that the names of the module to be created for the detected packages
become the trailing name underneath the base package. For example, scanning from com.acme
, an
ApplicationModule
located in com.acme.foo.bar
would be named foo.bar
.- Since:
- 1.3
- Author:
- Oliver Drotbohm
-
Constructor Summary
ConstructorDescriptionApplicationModuleSource
(JavaPackage moduleBasePackage, String moduleName) Creates an instance of aApplicationModuleSource
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static ApplicationModuleSource
from
(JavaPackage pkg, String name) Creates a newApplicationModuleSource
for the givenJavaPackage
and name.static Stream<ApplicationModuleSource>
from
(JavaPackage pkg, ApplicationModuleDetectionStrategy strategy, boolean fullyQualifiedModuleNames) Returns aStream
ofApplicationModuleSource
s by applying the givenApplicationModuleDetectionStrategy
to the given base package.final int
hashCode()
Returns a hash code value for this object.Returns the value of themoduleBasePackage
record component.Returns the value of themoduleName
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ApplicationModuleSource
ApplicationModuleSource(JavaPackage moduleBasePackage, String moduleName) Creates an instance of aApplicationModuleSource
record class.- Parameters:
moduleBasePackage
- the value for themoduleBasePackage
record componentmoduleName
- the value for themoduleName
record component
-
-
Method Details
-
from
public static Stream<ApplicationModuleSource> from(JavaPackage pkg, ApplicationModuleDetectionStrategy strategy, boolean fullyQualifiedModuleNames) Returns aStream
ofApplicationModuleSource
s by applying the givenApplicationModuleDetectionStrategy
to the given base package.- Parameters:
pkg
- must not be null.strategy
- must not be null.fullyQualifiedModuleNames
- whether to use fully qualified module names.- Returns:
- will never be null.
-
from
Creates a newApplicationModuleSource
for the givenJavaPackage
and name.- Parameters:
pkg
- must not be null.name
- must not be null or empty.- Returns:
- will never be null.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
moduleBasePackage
Returns the value of themoduleBasePackage
record component.- Returns:
- the value of the
moduleBasePackage
record component
-
moduleName
Returns the value of themoduleName
record component.- Returns:
- the value of the
moduleName
record component
-