gnodet commented on code in PR #2061:
URL: https://github.com/apache/maven/pull/2061#discussion_r1932720388


##########
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##########
@@ -234,4 +239,32 @@ default String getId() {
      */
     @Nonnull
     Optional<Project> getParent();
+
+    /**
+     * {@return all source root directories}, including the disabled ones, for 
all languages and scopes.
+     * For listing only the {@linkplain SourceRoot#enabled() enabled} source 
roots,
+     * the following code can be used:
+     *
+     * <pre>{@literal
+     * List<SourceRoot> enabledRoots = project.getSourceRoots()
+     *         .stream().filter(SourceRoot::enabled).toList();
+     * }</pre>
+     *
+     * The iteration order is the order in which the sources are declared in 
the POM file.
+     */
+    @Nonnull
+    Collection<SourceRoot> getSourceRoots();
+
+    /**
+     * {@return all enabled sources that provide files in the given language 
for the given scope}.
+     * If the given scope is {@code null}, then this method returns the 
enabled sources for all scopes.
+     * If the given language is {@code null}, then this method returns the 
enabled sources for all languages.
+     * An arbitrary number of source roots may exist for the same scope and 
language.
+     * It may be, for example, the case of a multi-versions project.
+     * The iteration order is the order in which the sources are declared in 
the POM file.
+     *
+     * @param scope the scope of the sources to return, or {@code null} for 
all scopes
+     * @param language the language of the sources to return, or {@code null} 
for all languages
+     */
+    Stream<SourceRoot> getEnabledSourceRoots(ProjectScope scope, Language 
language);

Review Comment:
   Yes, it could make sense to align with the `record` way of doing things.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to