invoke
Invokes the specified method on the target object with the given arguments.
This method provides a type-safe wrapper around invoke while avoiding the performance penalty of the spread operator.
example:
Method method = MyClass.class.getMethod("myMethod", String.class);
MyClass instance = new MyClass();
String result = FastInvoke.invoke(method, instance, new Object[]{"hello"});
Content copied to clipboard
Return
the result of the method invocation, or null if the method returns void
Parameters
method
the method to invoke; must not be null
target
the object on which to invoke the method, or null for static methods
args
the arguments to pass to the method; may be null if the method takes no arguments
<T>
the return type of the method
Throws
if the underlying method throws an exception
if the method is not accessible (e.g., private method)
if the method is an instance method and target is null, or if the arguments are not appropriate for the method