Package play.libs.reflect
Class MethodUtils
- Object
-
- play.libs.reflect.MethodUtils
-
public class MethodUtils extends Object
Imported from apache.commons.lang3 3.6
-
-
Constructor Summary
Constructors Constructor Description MethodUtils()
MethodUtils
instances should NOT be constructed in standard programming.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Method
getAccessibleMethod(Method method)
Returns an accessible method (that is, one that can be invoked via reflection) that implements the specified Method.static Method
getMatchingAccessibleMethod(Class<?> cls, String methodName, Class<?>... parameterTypes)
Finds an accessible method that matches the given name and has compatible parameters.
-
-
-
Constructor Detail
-
MethodUtils
public MethodUtils()
MethodUtils
instances should NOT be constructed in standard programming. Instead, the class should be used asMethodUtils.getAccessibleMethod(method)
.This constructor is
public
to permit tools that require a JavaBean instance to operate.
-
-
Method Detail
-
getAccessibleMethod
public static Method getAccessibleMethod(Method method)
Returns an accessible method (that is, one that can be invoked via reflection) that implements the specified Method. If no such method can be found, returnnull
.- Parameters:
method
- The method that we wish to call- Returns:
- The accessible method
-
getMatchingAccessibleMethod
public static Method getMatchingAccessibleMethod(Class<?> cls, String methodName, Class<?>... parameterTypes)
Finds an accessible method that matches the given name and has compatible parameters. Compatible parameters mean that every method parameter is assignable from the given parameters. In other words, it finds a method with the given name that will take the parameters given.This method can match primitive parameter by passing in wrapper classes. For example, a
Boolean
will match a primitiveboolean
parameter.- Parameters:
cls
- find method in this classmethodName
- find method with this nameparameterTypes
- find method with most compatible parameters- Returns:
- The accessible method
-
-