@API(status=STABLE, since="1.0") public class MethodSource extends java.lang.Object implements TestSource
TestSource
.
This class stores the method name along with its parameter types because
Method
does not implement Serializable
.
MethodSelector
,
Serialized FormModifier and Type | Field and Description |
---|---|
private java.lang.String |
className |
private java.lang.String |
methodName |
private java.lang.String |
methodParameterTypes |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
MethodSource(java.lang.reflect.Method method) |
private |
MethodSource(java.lang.String className,
java.lang.String methodName) |
private |
MethodSource(java.lang.String className,
java.lang.String methodName,
java.lang.String methodParameterTypes) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static MethodSource |
from(java.lang.reflect.Method method)
Create a new
MethodSource using the supplied
method . |
static MethodSource |
from(java.lang.String className,
java.lang.String methodName)
Create a new
MethodSource using the supplied
class and method name. |
static MethodSource |
from(java.lang.String className,
java.lang.String methodName,
java.lang.String methodParameterTypes)
Create a new
MethodSource using the supplied
class and method name. |
java.lang.String |
getClassName()
Get the declaring
Class name of this source. |
java.lang.String |
getMethodName()
Get the
Method name of this source. |
java.lang.String |
getMethodParameterTypes()
Get the
Method parameter types of this source. |
int |
hashCode() |
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.lang.String className
private final java.lang.String methodName
private final java.lang.String methodParameterTypes
private MethodSource(java.lang.String className, java.lang.String methodName)
private MethodSource(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
private MethodSource(java.lang.reflect.Method method)
public static MethodSource from(java.lang.String className, java.lang.String methodName)
MethodSource
using the supplied
class and method name.className
- the Class
name; must not be null
or blankmethodName
- the Method
name; must not be null
or blankpublic static MethodSource from(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
MethodSource
using the supplied
class and method name.className
- the Class
name; must not be null
or blankmethodName
- the Method
name; must not be null
or blankmethodParameterTypes
- the Method
parameter types as stringpublic static MethodSource from(java.lang.reflect.Method method)
MethodSource
using the supplied
method
.method
- the Java method; must not be null
public java.lang.String getClassName()
Class
name of this source.public final java.lang.String getMethodName()
Method
name of this source.public final java.lang.String getMethodParameterTypes()
Method
parameter types of this source.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object