@API(status=STABLE,
since="1.6")
public class NestedMethodSelector
extends java.lang.Object
implements DiscoverySelector
DiscoverySelector that selects a nested Method
or a combination of enclosing classes names, class name, method
name, and parameter types so that
TestEngines can discover
tests or containers based on methods.
If a Java Method is provided, the selector will return that
method and its method name, class name, enclosing
classes names, and parameter types accordingly. If class names or method names
are provided, this selector will only attempt to lazily load a class or method
if getEnclosingClasses(), getNestedClass(),
getMethod(), or getParameterTypes() is invoked.
In this context, a Java Method means anything that can be referenced
as a Method on the JVM — for example, methods from Java classes
or methods from other JVM languages such Groovy, Scala, etc.
DiscoverySelectors.selectNestedMethod(List, String, String),
DiscoverySelectors.selectNestedMethod(List, String, String, String),
DiscoverySelectors.selectNestedMethod(List, Class, String),
DiscoverySelectors.selectNestedMethod(List, Class, String, String),
DiscoverySelectors.selectNestedMethod(List, Class, Method),
MethodSource,
NestedClassSelector,
MethodSelector| Modifier and Type | Field and Description |
|---|---|
private MethodSelector |
methodSelector |
private NestedClassSelector |
nestedClassSelector |
| Constructor and Description |
|---|
NestedMethodSelector(java.lang.ClassLoader classLoader,
java.util.List<java.lang.String> enclosingClassNames,
java.lang.String nestedClassName,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes) |
NestedMethodSelector(java.lang.ClassLoader classLoader,
java.util.List<java.lang.String> enclosingClassNames,
java.lang.String nestedClassName,
java.lang.String methodName,
java.lang.String parameterTypeNames) |
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.reflect.Method method) |
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes) |
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.String methodName,
java.lang.String parameterTypeNames) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.ClassLoader |
getClassLoader()
Get the
ClassLoader used to load the nested class. |
java.util.List<java.lang.Class<?>> |
getEnclosingClasses()
Get the list of
Class enclosing the nested Class
containing the selected Method. |
java.util.List<java.lang.String> |
getEnclosingClassNames()
Get the names of the classes enclosing the nested class
containing the selected method.
|
java.lang.reflect.Method |
getMethod()
Get the selected
Method. |
java.lang.String |
getMethodName()
Get the name of the selected method.
|
java.lang.String |
getMethodParameterTypes()
Deprecated.
since 1.10 in favor or
getParameterTypeNames() |
java.lang.Class<?> |
getNestedClass()
Get the nested
Class containing the selected Method. |
java.lang.String |
getNestedClassName()
Get the name of the nested class containing the selected method.
|
java.lang.String |
getParameterTypeNames()
Get the names of parameter types for the selected method as a
String. |
java.lang.Class<?>[] |
getParameterTypes()
Get the parameter types for the selected method.
|
int |
hashCode() |
java.lang.String |
toString() |
private final NestedClassSelector nestedClassSelector
private final MethodSelector methodSelector
NestedMethodSelector(java.lang.ClassLoader classLoader,
java.util.List<java.lang.String> enclosingClassNames,
java.lang.String nestedClassName,
java.lang.String methodName,
java.lang.String parameterTypeNames)
NestedMethodSelector(java.lang.ClassLoader classLoader,
java.util.List<java.lang.String> enclosingClassNames,
java.lang.String nestedClassName,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes)
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.String methodName,
java.lang.String parameterTypeNames)
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes)
NestedMethodSelector(java.util.List<java.lang.Class<?>> enclosingClasses,
java.lang.Class<?> nestedClass,
java.lang.reflect.Method method)
@API(status=EXPERIMENTAL,
since="1.10")
public java.lang.ClassLoader getClassLoader()
ClassLoader used to load the nested class.public java.util.List<java.lang.String> getEnclosingClassNames()
public java.util.List<java.lang.Class<?>> getEnclosingClasses()
Class enclosing the nested Class
containing the selected Method.
If the Class were not provided, but only the name of the
nested class and its enclosing classes, this method attempts to lazily
load the list of enclosing Class and throws a
PreconditionViolationException if the classes cannot be loaded.
public java.lang.String getNestedClassName()
public java.lang.Class<?> getNestedClass()
Class containing the selected Method.
If the Class were not provided, but only the name of the
nested class and its enclosing classes, this method attempts to lazily
load the nested Class and throws a
PreconditionViolationException if the class cannot be loaded.
public java.lang.String getMethodName()
public java.lang.reflect.Method getMethod()
Method.
If the Method was not provided, but only the name, this method
attempts to lazily load the Method based on its name and throws a
PreconditionViolationException if the method cannot be loaded.
@Deprecated
@API(status=DEPRECATED,
since="1.10")
public java.lang.String getMethodParameterTypes()
getParameterTypeNames()See getParameterTypeNames() for details.
getParameterTypeNames(),
getParameterTypes()@API(status=STABLE,
since="1.10")
public java.lang.String getParameterTypeNames()
String.
See MethodSelector.getParameterTypeNames() for details.
NestedMethodSelector
via a constructor or deduced from a Method or parameter types supplied
via a constructor; never null but potentially an empty stringMethodSelector.getParameterTypeNames()@API(status=EXPERIMENTAL,
since="1.10")
public java.lang.Class<?>[] getParameterTypes()
See MethodSelector.getParameterTypes() for details.
null but potentially
an empty array if the selected method does not declare parametersgetParameterTypeNames(),
MethodSelector.getParameterTypes()public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object