Exemple #1
0
 /** Returns a flat list of all interfaces and super types for the given {@link IType}. */
 public static List<String> getFlatListOfClassAndInterfaceNames(IType parameterType, IType type) {
   List<String> requiredTypes = new ArrayList<String>();
   if (parameterType != null) {
     do {
       try {
         requiredTypes.add(parameterType.getFullyQualifiedName());
         String[] interfaceNames = parameterType.getSuperInterfaceNames();
         for (String interfaceName : interfaceNames) {
           if (interfaceName != null) {
             if (type.isBinary()) {
               requiredTypes.add(interfaceName);
             }
             String resolvedName = resolveClassName(interfaceName, type);
             if (resolvedName != null) {
               requiredTypes.add(resolvedName);
             }
           }
         }
         parameterType = Introspector.getSuperType(parameterType);
       } catch (JavaModelException e) {
       }
     } while (parameterType != null
         && !parameterType.getFullyQualifiedName().equals(Object.class.getName()));
   }
   return requiredTypes;
 }
 private void printSuperclassAndInterfaces(IType type, StringBuilder sb)
     throws JavaModelException {
   String superclass = type.getSuperclassName();
   if (superclass != null) sb.append("<SUPERCLASS>" + superclass + "</SUPERCLASS>");
   String[] interfaces = type.getSuperInterfaceNames();
   if (interfaces.length > 0) {
     sb.append("<INTERFACES>");
     for (String anInterface : interfaces) {
       sb.append("<INTERFACE>" + anInterface + "</INTERFACE>");
     }
     sb.append("</INTERFACES>");
   }
 }