Files

32 lines
1011 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Grim.js — callAny() (satır 603)
[← Grim.js](index.md) · [← Master](../../wiki.md)
```javascript
function callAny(object, names, args) {
args = args || [];
for (var i = 0; i < names.length; i++) {
try {
var direct = object[names[i]];
if (typeof direct === "function") return direct.apply(object, args);
} catch (e) {}
}
var cls = object.getClass();
while (cls != null) {
var methods = cls.getDeclaredMethods();
for (var m = 0; m < methods.length; m++) {
var method = methods[m];
var name = String(method.getName());
if (names.indexOf(name) !== -1 && method.getParameterTypes().length === args.length) {
method.setAccessible(true);
return method.invoke(object, Java.to(args, "java.lang.Object[]"));
}
}
cls = cls.getSuperclass();
}
throw "Method bulunamadi: " + names.join("/");
}
```