@Override public String toString() { StringBuffer sb = new StringBuffer(); for (int i = 0, N = methods.length; i != N; ++i) { Method method = methods[i].method(); sb.append(JavaMembers.javaSignature(method.getReturnType())); sb.append(' '); sb.append(method.getName()); sb.append(JavaMembers.liveConnectSignature(methods[i].argTypes)); sb.append('\n'); } return sb.toString(); }
private static void printDebug(String msg, MemberBox member, Object[] args) { if (debug) { StringBuffer sb = new StringBuffer(); sb.append(" ----- "); sb.append(msg); sb.append(member.getDeclaringClass().getName()); sb.append('.'); if (member.isMethod()) { sb.append(member.getName()); } sb.append(JavaMembers.liveConnectSignature(member.argTypes)); sb.append(" for arguments ("); sb.append(scriptSignature(args)); sb.append(')'); System.out.println(sb); } }
static String scriptSignature(Object[] values) { StringBuffer sig = new StringBuffer(); for (int i = 0; i != values.length; ++i) { Object value = values[i]; String s; if (value == null) { s = "null"; } else if (value instanceof Boolean) { s = "boolean"; } else if (value instanceof String) { s = "string"; } else if (value instanceof Number) { s = "number"; } else if (value instanceof Scriptable) { if (value instanceof Undefined) { s = "undefined"; } else if (value instanceof Wrapper) { Object wrapped = ((Wrapper) value).unwrap(); s = wrapped.getClass().getName(); } else if (value instanceof Function) { s = "function"; } else { s = "object"; } } else { s = JavaMembers.javaSignature(value.getClass()); } if (i != 0) { sig.append(','); } sig.append(s); } return sig.toString(); }