protected void createFragmentForMethod(IMethodBinding method, StringBuilder uriBuilder) { ITypeBinding declaringType = method.getDeclaringClass(); createFragmentForClass(declaringType, uriBuilder); uriBuilder.append('.'); uriBuilder.append(method.getName()); uriBuilder.append('('); ITypeBinding[] parameterTypes = method.getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { if (i != 0) { uriBuilder.append(','); } getQualifiedName(parameterTypes[i], uriBuilder); } uriBuilder.append(')'); }
protected void createFragmentForClass(String signature, StringBuilder uriBuilder) { String fragment = Signature.toString(signature); if (fragment.startsWith("new ")) { int dollar = signature.lastIndexOf('$'); createFragmentForClass(signature.substring(0, dollar) + ";", uriBuilder); uriBuilder.append(signature.substring(dollar, signature.length() - 1)); return; } int start = signature.length(); int lastDot = fragment.length(); while ((start = signature.lastIndexOf('$', start)) >= 0) { lastDot = fragment.lastIndexOf('.', lastDot); if (lastDot == -1) break; fragment = fragment.substring(0, lastDot) + '$' + fragment.substring(lastDot + 1); start--; } uriBuilder.append(fragment); }
protected void createFragment(String signature, StringBuilder uriBuilder) { int signatureKind = Signature.getTypeSignatureKind(signature); switch (signatureKind) { case Signature.BASE_TYPE_SIGNATURE: createFragmentForPrimitive(signature, uriBuilder); return; case Signature.CLASS_TYPE_SIGNATURE: createFragmentForClass(signature, uriBuilder); return; case Signature.ARRAY_TYPE_SIGNATURE: createFragmentForArray(signature, uriBuilder); return; case Signature.TYPE_VARIABLE_SIGNATURE: createFragmentForTypeVariable(signature, uriBuilder); return; default: throw new IllegalStateException("Unexpected Signature: " + signature); } }
protected void createFragment(ITypeBinding typeBinding, StringBuilder uriBuilder) { if (typeBinding.isPrimitive()) { createFragmentForPrimitive(typeBinding, uriBuilder); return; } if (typeBinding.isArray()) { createFragmentForArray(typeBinding, uriBuilder); return; } if (typeBinding.isTypeVariable()) { createFragmentForTypeVariable(typeBinding, uriBuilder); return; } if (typeBinding.isAnnotation() || typeBinding.isClass() || typeBinding.isInterface() || typeBinding.isEnum()) { createFragmentForClass(typeBinding, uriBuilder); return; } throw new IllegalStateException("Unexpected type binding: " + typeBinding); }