@API(value=Experimental) public final class DiscoverySelectors extends java.lang.Object
static
factory methods for creating
DiscoverySelectors
.ClasspathSelector
,
ClassSelector
,
MethodSelector
,
PackageSelector
Modifier and Type | Method and Description |
---|---|
static ClassSelector |
selectClass(java.lang.Class<?> clazz)
Create a
ClassSelector for the supplied Class . |
static ClassSelector |
selectClass(java.lang.String className)
Create a
ClassSelector for the supplied class name. |
static java.util.List<DiscoverySelector> |
selectClasspathRoots(java.util.Set<java.io.File> directories)
Create a list of
ClasspathSelectors for the supplied directories . |
static MethodSelector |
selectMethod(java.lang.Class<?> clazz,
java.lang.reflect.Method method)
Create a
MethodSelector for the supplied Class and Method . |
static MethodSelector |
selectMethod(java.lang.Class<?> clazz,
java.lang.String methodName)
Create a
MethodSelector for the supplied Class and method name. |
static MethodSelector |
selectMethod(java.lang.String className,
java.lang.String methodName)
Create a
MethodSelector for the supplied class name and method name. |
static DiscoverySelector |
selectName(java.lang.String name)
Create a
DiscoverySelector for the supplied name. |
static java.util.List<DiscoverySelector> |
selectNames(java.util.Collection<java.lang.String> names)
Create a list of
DiscoverySelectors for the
supplied names. |
static java.util.List<DiscoverySelector> |
selectNames(java.lang.String... names)
Create a list of
DiscoverySelectors for the
supplied names. |
static PackageSelector |
selectPackage(java.lang.String packageName)
Create a
PackageSelector for the supplied package name. |
static UniqueIdSelector |
selectUniqueId(java.lang.String uniqueId)
Create a
UniqueIdSelector for the supplied unique ID. |
static UniqueIdSelector |
selectUniqueId(UniqueId uniqueId)
Create a
UniqueIdSelector for the supplied UniqueId . |
public static java.util.List<DiscoverySelector> selectClasspathRoots(java.util.Set<java.io.File> directories)
ClasspathSelectors
for the supplied directories
.directories
- set of directories in the filesystem that represent classpath roots;
never null
ClasspathSelector
public static PackageSelector selectPackage(java.lang.String packageName)
PackageSelector
for the supplied package name.packageName
- the package name to select; never null
or blankPackageSelector
public static ClassSelector selectClass(java.lang.Class<?> clazz)
ClassSelector
for the supplied Class
.clazz
- the class to select; never null
ClassSelector
public static ClassSelector selectClass(java.lang.String className)
ClassSelector
for the supplied class name.className
- the fully qualified name of the class to select;
never null
or blankClassSelector
public static MethodSelector selectMethod(java.lang.String className, java.lang.String methodName)
MethodSelector
for the supplied class name and method name.className
- the fully qualified name of the class in which the method
is declared, or a subclass thereof; never null
or blankmethodName
- the name of the method to select; never null
or blankMethodSelector
public static MethodSelector selectMethod(java.lang.Class<?> clazz, java.lang.String methodName)
MethodSelector
for the supplied Class
and method name.clazz
- the class in which the method is declared, or a subclass thereof;
never null
methodName
- the name of the method to select; never null
or blankMethodSelector
public static MethodSelector selectMethod(java.lang.Class<?> clazz, java.lang.reflect.Method method)
MethodSelector
for the supplied Class
and Method
.clazz
- the class in which the method is declared, or a subclass thereof;
never null
method
- the method to select; never null
MethodSelector
public static DiscoverySelector selectName(java.lang.String name) throws PreconditionViolationException
DiscoverySelector
for the supplied name.
The supported format for a fully qualified method name is
[fully qualified class name]#[methodName]
. For example, the
fully qualified name for the chars()
method in
java.lang.String
is java.lang.String#chars
. Names for
overloaded methods are not supported.
name
- the name to select; never null
or blankClassSelector
, MethodSelector
, or
PackageSelector
PreconditionViolationException
- if the supplied name is null
,
blank, or does not specify a class, method, or packageselectNames(String...)
,
selectNames(Collection)
public static java.util.List<DiscoverySelector> selectNames(java.lang.String... names)
DiscoverySelectors
for the
supplied names.
Consult the documentation for selectName(String)
for details
on what types of names are supported.
names
- the names to select; never null
DiscoverySelectors
for the supplied names;
potentially emptyselectName(String)
,
selectNames(Collection)
public static java.util.List<DiscoverySelector> selectNames(java.util.Collection<java.lang.String> names)
DiscoverySelectors
for the
supplied names.
Consult the documentation for selectName(String)
for details
on what types of names are supported.
names
- the names to select; never null
DiscoverySelectors
for the supplied names;
potentially emptyselectName(String)
,
selectNames(String...)
public static UniqueIdSelector selectUniqueId(UniqueId uniqueId)
UniqueIdSelector
for the supplied UniqueId
.uniqueId
- the UniqueId
to select; never null
UniqueIdSelector
public static UniqueIdSelector selectUniqueId(java.lang.String uniqueId)
UniqueIdSelector
for the supplied unique ID.uniqueId
- the unique ID to select; never null
or blankUniqueIdSelector