Interface SourceDependency
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
SourceDependency.BelongsTo
,SourceDependency.Import
,SourceDependency.Include
@NonNullByDefault
public sealed interface SourceDependency
extends Serializable
permits SourceDependency.Import, SourceDependency.Include, SourceDependency.BelongsTo
Common interface expressing a dependency on a source, be it a
ModuleStatement
or a SubmoduleStatement
.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
A dependency created by aBelongsToStatement
.static final record
A dependency created by anImportStatement
.static final record
A dependency created by anIncludeStatement
. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
isSatisfiedBy
(SourceIdentifier sourceId) Check if a givenSourceIdentifier
satisfies the needs of this dependency.name()
The name of the required source.@Nullable Revision
revision()
Returns required source revision.
-
Method Details
-
name
UnresolvedQName.Unqualified name()The name of the required source.- Returns:
- name of the required source
-
revision
@Nullable Revision revision()Returns required source revision. If specified, this dependency can be satisfied only by the specified revision or its semantic equivalent (think semantic version of imports). If unspecified, this dependency can be satisfied by any source with a matchingname()
.Satisfaction criteria can be easily be valuated via
isSatisfiedBy(SourceIdentifier)
.- Returns:
- required source revision,
null
if unspecified
-
isSatisfiedBy
Check if a givenSourceIdentifier
satisfies the needs of this dependency.- Parameters:
sourceId
- givenSourceIdentifier
- Returns:
true
if theSourceIdentifier
satisfies this dependency- Throws:
NullPointerException
- ifsourceId
isnull
-