From a84f49f26aedd918e48bae5ac3aec2592492f6b6 Mon Sep 17 00:00:00 2001 From: Tumi Date: Tue, 24 Dec 2013 15:27:38 +0100 Subject: [PATCH] Added invoke(Object, Class[], Object...) method Added a new invoke method that ensures the proper method invocation in the accessed instance, in case of overloadings. --- src/com/esotericsoftware/reflectasm/MethodAccess.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/esotericsoftware/reflectasm/MethodAccess.java b/src/com/esotericsoftware/reflectasm/MethodAccess.java index 2bf8f0e..d0de66d 100644 --- a/src/com/esotericsoftware/reflectasm/MethodAccess.java +++ b/src/com/esotericsoftware/reflectasm/MethodAccess.java @@ -20,6 +20,11 @@ public abstract class MethodAccess { abstract public Object invoke (Object object, int methodIndex, Object... args); + /** Invokes the method with the specified name and the specified param types. */ + public Object invoke (Object object, String methodName, Class[] paramTypes, Object... args) { + return invoke(object, getIndex(methodName, paramTypes), args); + } + /** Invokes the first method with the specified name and the specified number of arguments. */ public Object invoke (Object object, String methodName, Object... args) { return invoke(object, getIndex(methodName, args.length), args);