@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 name)
Create a
MethodSelector for the supplied fully qualified
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)
Deprecated.
This method will be removed in 5.0 M3; use
selectPackage(String) , selectClass(String) , or
selectMethod(String) instead. |
static java.util.List<DiscoverySelector> |
selectNames(java.util.Collection<java.lang.String> names)
Deprecated.
This method will be removed in 5.0 M3; use
selectPackage(String) , selectClass(String) , or
selectMethod(String) instead. |
static java.util.List<DiscoverySelector> |
selectNames(java.lang.String... names)
Deprecated.
This method will be removed in 5.0 M3; use
selectPackage(String) , selectClass(String) , or
selectMethod(String) instead. |
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 name) throws PreconditionViolationException
MethodSelector
for the supplied fully qualified
method 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"
.
WARNING: Overloaded methods and methods that accept arguments are not currently supported.
name
- the fully qualified name of the method to select; never
null
or blankPreconditionViolationException
- if the supplied name is null
,
blank, or does not specify a unique methodMethodSelector
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
@Deprecated @API(value=Deprecated) public static DiscoverySelector selectName(java.lang.String name) throws PreconditionViolationException
selectPackage(String)
, selectClass(String)
, or
selectMethod(String)
instead.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 packageselectPackage(String)
,
selectClass(String)
,
selectMethod(String)
@Deprecated @API(value=Deprecated) public static java.util.List<DiscoverySelector> selectNames(java.lang.String... names)
selectPackage(String)
, selectClass(String)
, or
selectMethod(String)
instead.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 emptyselectPackage(String)
,
selectClass(String)
,
selectMethod(String)
@Deprecated @API(value=Deprecated) public static java.util.List<DiscoverySelector> selectNames(java.util.Collection<java.lang.String> names)
selectPackage(String)
, selectClass(String)
, or
selectMethod(String)
instead.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 emptyselectPackage(String)
,
selectClass(String)
,
selectMethod(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