Ejemplo n.º 1
0
 protected void createFragmentForTypeVariable(ITypeBinding typeBinding, StringBuilder uriBuilder) {
   if (typeBinding.getDeclaringMethod() != null) {
     createFragmentForMethod(typeBinding.getDeclaringMethod(), uriBuilder);
   } else {
     createFragment(typeBinding.getDeclaringClass(), uriBuilder);
   }
   uriBuilder.append('/');
   uriBuilder.append(typeBinding.getName());
 }
Ejemplo n.º 2
0
 /** @since 2.4 */
 protected URI getFullURI(ITypeBinding typeBinding, SegmentSequence.Builder builder) {
   if (typeBinding.isPrimitive()) {
     builder.append(PRIMITIVE_URIS[typeBinding.getKey().charAt(0) - 'B'].fragment());
     return PRIMITIVES_URI;
   }
   if (typeBinding.isClass()
       || typeBinding.isInterface()
       || typeBinding.isAnnotation()
       || typeBinding.isEnum()) {
     ITypeBinding declaringClass = typeBinding.getDeclaringClass();
     if (declaringClass != null) {
       URI uri = getFullURI(declaringClass, builder);
       builder.append("$");
       builder.append(typeBinding.getName());
       return uri;
     }
     String qualifiedName = typeBinding.getErasure().getQualifiedName();
     URI uri = COMMON_URIS.get(qualifiedName);
     if (uri == null) {
       uri = OBJECTS_URI.appendSegment(qualifiedName);
     }
     builder.append(uri.lastSegment());
     return uri;
   }
   if (typeBinding.isArray()) {
     URI uri = getFullURI(typeBinding.getComponentType(), builder);
     builder.append("[]");
     return uri;
   }
   if (typeBinding.isTypeVariable()) {
     ITypeBinding declaringClass = typeBinding.getDeclaringClass();
     if (declaringClass != null) {
       URI uri = getFullURI(declaringClass, builder);
       builder.append("/");
       builder.append(typeBinding.getName());
       return uri;
     }
     IMethodBinding declaringMethod = typeBinding.getDeclaringMethod();
     URI uri = getFullURI(declaringMethod.getDeclaringClass(), builder);
     builder.append(".");
     builder.append(declaringMethod.getName());
     builder.append("(");
     ITypeBinding[] parameterTypes = declaringMethod.getParameterTypes();
     for (int i = 0; i < parameterTypes.length; i++) {
       if (i != 0) {
         builder.append(",");
       }
       getQualifiedName(parameterTypes[i], builder);
     }
     builder.append(")");
     builder.append("/");
     builder.append(typeBinding.getName());
     return uri;
   }
   throw new IllegalStateException("Unexpected type: " + typeBinding);
 }
Ejemplo n.º 3
0
 protected void createResourceURIForTypeVariable(
     ITypeBinding typeBinding, StringBuilder uriBuilder) {
   if (typeBinding.getDeclaringClass() != null) {
     ITypeBinding declaringClass = typeBinding.getDeclaringClass();
     createResourceURIForClass(declaringClass, uriBuilder);
   } else {
     IMethodBinding declaringMethod = typeBinding.getDeclaringMethod();
     ITypeBinding declaringClass = declaringMethod.getDeclaringClass();
     createResourceURIForClass(declaringClass, uriBuilder);
   }
 }