Package play.libs.reflect
Class MethodUtils
java.lang.Object
play.libs.reflect.MethodUtils
Imported from apache.commons.lang3 3.6
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodgetAccessibleMethod(Method method) Returns an accessible method (that is, one that can be invoked via reflection) that implements the specified Method.static MethodgetMatchingAccessibleMethod(Class<?> cls, String methodName, Class<?>... parameterTypes) Finds an accessible method that matches the given name and has compatible parameters.
-
Constructor Details
-
MethodUtils
public MethodUtils()MethodUtilsinstances should NOT be constructed in standard programming. Instead, the class should be used asMethodUtils.getAccessibleMethod(method).This constructor is
publicto permit tools that require a JavaBean instance to operate.
-
-
Method Details
-
getAccessibleMethod
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
Booleanwill match a primitivebooleanparameter.- Parameters:
cls- find method in this classmethodName- find method with this nameparameterTypes- find method with most compatible parameters- Returns:
- The accessible method
-