public class ReflectionTools
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionTools() |
| Modifier and Type | Method and Description |
|---|---|
static int |
distance(java.lang.Class<?> sup,
java.lang.Class<?> sub)
Calculates the distance from the designated subclass to the designated superclass:
Equal classes have the distance 0.
|
static MethodWrapper |
getCorrespondingVarArgsMethod(java.lang.String name,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] paramValues,
java.lang.Class<?> searchedClass)
Gets the method from the designated class that corresponds to the designated method but has an
additional varargs parameter or the designated method has an varargs parameter but the returned
method from the designated class has not.
|
public static int distance(java.lang.Class<?> sup,
java.lang.Class<?> sub)
null, the distance will be Integer.MAX_VALUE.sup - The class (as fixed point) to which to calculate the distance.sub - The class from which to calculate the distance.public static MethodWrapper getCorrespondingVarArgsMethod(java.lang.String name, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues, java.lang.Class<?> searchedClass)
null will be returned. null or an array only containing null.
In this case we expect the call to the varargs method equal to calling the method without the
last parameter and the varargs parameter to be irrelevant.name - The name of the method/constructor to get the corresponding method/constructor for.paramTypes - The parameter types of the method/constructor to get a corresponding
method/constructor for. This must not be null.paramValues - The parameter values of the method/constructor. This is only relevant when
looking for a corresponding non-varargs method/constructor. In all other cases simply
use null.searchedClass - The class to get the corresponding method/constructor having an additional
varargs parameter or not having the varargs parameter.null. If no such method/constructor is found or if there are several
methods/constructors found matching this criteria, null will be returned.