// check for binding methods defined in class
Method[] methods = getMethods();
int count = 0;
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
String name = method.getName();
if (name.startsWith(prefix)) {
count++;
} else {
String sig = method.getSignature();
for (int j = 0; j < matches.length; j += 2) {
if (name.equals(matches[j]) && sig.equals(matches[j+1])) {
count++;
break;
}
}
}
}
// generate array of methods found
if (count == 0) {
return EMPTY_METHOD_ARRAY;
} else {
ExistingMethod[] exists = new ExistingMethod[count];
int fill = 0;
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
String name = method.getName();
boolean match = name.startsWith(prefix);
if (!match) {
String sig = method.getSignature();
for (int j = 0; j < matches.length; j += 2) {
if (name.equals(matches[j]) &&
sig.equals(matches[j+1])) {
match = true;
break;