-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow third parties to provide a custom
ClasspathScanner
implementa…
…tion (#4191) Resolves #3628 --------- Co-authored-by: Marc Philipp <[email protected]>
- Loading branch information
1 parent
3aa0f48
commit 6fb2ea3
Showing
25 changed files
with
284 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
junit-platform-commons/src/main/java/org/junit/platform/commons/function/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* Maintained functional interfaces and support classes. | ||
* Functional interfaces and support classes. | ||
*/ | ||
|
||
package org.junit.platform.commons.function; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...orm-commons/src/main/java/org/junit/platform/commons/support/conversion/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* Maintained conversion APIs provided by the JUnit Platform. | ||
* Conversion APIs provided by the JUnit Platform. | ||
*/ | ||
|
||
package org.junit.platform.commons.support.conversion; |
2 changes: 1 addition & 1 deletion
2
junit-platform-commons/src/main/java/org/junit/platform/commons/support/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...m-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright 2015-2024 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v2.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
*/ | ||
|
||
package org.junit.platform.commons.support.scanning; | ||
|
||
import static org.apiguardian.api.API.Status; | ||
|
||
import java.net.URI; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
|
||
import org.apiguardian.api.API; | ||
import org.junit.platform.commons.support.Resource; | ||
|
||
/** | ||
* {@code ClasspathScanner} allows to scan the classpath for classes and | ||
* resources. | ||
* | ||
* <p>An implementation of this interface can be registered via the | ||
* {@link java.util.ServiceLoader ServiceLoader} mechanism. | ||
* | ||
* @since 1.12 | ||
*/ | ||
@API(status = Status.EXPERIMENTAL, since = "1.12") | ||
public interface ClasspathScanner { | ||
|
||
/** | ||
* Find all {@linkplain Class classes} in the supplied classpath {@code root} | ||
* that match the specified {@code classFilter} filter. | ||
* | ||
* <p>The classpath scanning algorithm searches recursively in subpackages | ||
* beginning with the root of the classpath. | ||
* | ||
* @param basePackageName the name of the base package in which to start | ||
* scanning; must not be {@code null} and must be valid in terms of Java | ||
* syntax | ||
* @param classFilter the class type filter; never {@code null} | ||
* @return a list of all such classes found; never {@code null} | ||
* but potentially empty | ||
*/ | ||
List<Class<?>> scanForClassesInPackage(String basePackageName, ClassFilter classFilter); | ||
|
||
/** | ||
* Find all {@linkplain Class classes} in the supplied classpath {@code root} | ||
* that match the specified {@code classFilter} filter. | ||
* | ||
* <p>The classpath scanning algorithm searches recursively in subpackages | ||
* beginning with the root of the classpath. | ||
* | ||
* @param root the URI for the classpath root in which to scan; never | ||
* {@code null} | ||
* @param classFilter the class type filter; never {@code null} | ||
* @return a list of all such classes found; never {@code null} | ||
* but potentially empty | ||
*/ | ||
List<Class<?>> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter); | ||
|
||
/** | ||
* Find all {@linkplain Resource resources} in the supplied classpath {@code root} | ||
* that match the specified {@code resourceFilter} predicate. | ||
* | ||
* <p>The classpath scanning algorithm searches recursively in subpackages | ||
* beginning with the root of the classpath. | ||
* | ||
* @param basePackageName the name of the base package in which to start | ||
* scanning; must not be {@code null} and must be valid in terms of Java | ||
* syntax | ||
* @param resourceFilter the resource type filter; never {@code null} | ||
* @return a list of all such resources found; never {@code null} | ||
* but potentially empty | ||
*/ | ||
List<Resource> scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter); | ||
|
||
/** | ||
* Find all {@linkplain Resource resources} in the supplied classpath {@code root} | ||
* that match the specified {@code resourceFilter} predicate. | ||
* | ||
* <p>The classpath scanning algorithm searches recursively in subpackages | ||
* beginning with the root of the classpath. | ||
* | ||
* @param root the URI for the classpath root in which to scan; never | ||
* {@code null} | ||
* @param resourceFilter the resource type filter; never {@code null} | ||
* @return a list of all such resources found; never {@code null} | ||
* but potentially empty | ||
*/ | ||
List<Resource> scanForResourcesInClasspathRoot(URI root, Predicate<Resource> resourceFilter); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.