Class MethodInvocationUtils
java.lang.Object
org.springframework.security.util.MethodInvocationUtils
Static utility methods for creating
MethodInvocations usable within Spring
Security.
All methods of this class return a
SimpleMethodInvocation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable org.aopalliance.intercept.MethodInvocationGenerates aMethodInvocationfor specifiedmethodNameon the passed object, using theargsto locate the method.static @Nullable org.aopalliance.intercept.MethodInvocationcreateFromClass(@Nullable Object targetObject, Class<?> clazz, String methodName, Class<?> @Nullable [] classArgs, Object @Nullable [] args) Generates aMethodInvocationfor specifiedmethodNameon the passed class, using theargsto locate the method.static @Nullable org.aopalliance.intercept.MethodInvocationcreateFromClass(Class<?> clazz, String methodName) Generates aMethodInvocationfor the specifiedmethodNameon the passed class.
-
Method Details
-
create
public static @Nullable org.aopalliance.intercept.MethodInvocation create(Object object, String methodName, Object... args) Generates aMethodInvocationfor specifiedmethodNameon the passed object, using theargsto locate the method.- Parameters:
object- the object that will be used to find the relevantMethodmethodName- the name of the method to findargs- arguments that are required as part of the method signature (can be empty)- Returns:
- a
MethodInvocation, ornullif there was a problem
-
createFromClass
public static @Nullable org.aopalliance.intercept.MethodInvocation createFromClass(Class<?> clazz, String methodName) Generates aMethodInvocationfor the specifiedmethodNameon the passed class. If a method with this name, taking no arguments does not exist, it will check through the declared methods on the class, until one is found matching the supplied name. If more than one method name matches, an IllegalArgumentException will be raised.- Parameters:
clazz- the class of object that will be used to find the relevantMethodmethodName- the name of the method to find- Returns:
- a
MethodInvocation, ornullif there was a problem
-
createFromClass
public static @Nullable org.aopalliance.intercept.MethodInvocation createFromClass(@Nullable Object targetObject, Class<?> clazz, String methodName, Class<?> @Nullable [] classArgs, Object @Nullable [] args) Generates aMethodInvocationfor specifiedmethodNameon the passed class, using theargsto locate the method.- Parameters:
targetObject- the object being invokedclazz- the class of object that will be used to find the relevantMethodmethodName- the name of the method to findclassArgs- arguments that are required to locate the relevant method signatureargs- the actual arguments that should be passed to SimpleMethodInvocation- Returns:
- a
MethodInvocation, ornullif there was a problem
-