Package p = c.getPackage(); if (null != imports && !"java.lang".equals(p.getName())) imports.add(c.getName()); if (container) { if (fullnames) return c.getName(); else return c.getSimpleName();
if (c.isArray()) { return collapseType(c.getComponentType(), imports, structs, container, fullnames)+"[]";
   private static String collapseType(Type t, Set<String> imports, Map<StructStruct, Type[]> structs, boolean container, boolean fullnames) throws DBusException   {      if (t instanceof ParameterizedType) {         String s;         Class c = (Class) ((ParameterizedType) t).getRawType();         if (null != structs && t instanceof DBusStructType) {            int num = 1;            String name = "Struct";            while (null != structs.get(new StructStruct(name+num))) num++;            name = name+num;            structs.put(new StructStruct(name), ((ParameterizedType) t).getActualTypeArguments());            return name;         }         if (null != imports) imports.add(c.getName());         if (fullnames) return c.getName();         else s = c.getSimpleName();         s += '<';         Type[] ts = ((ParameterizedType) t).getActualTypeArguments();         for (Type st: ts)            s += collapseType(st, imports, structs, container, fullnames)+',';         s.replaceAll(",$", ">");         return s;      } else if (t instanceof Class) {         Class c = (Class) t;         Package p = c.getPackage();         if (null != imports &&                !"java.lang".equals(p.getName())) imports.add(c.getName());         if (container) {            if (fullnames) return c.getName();            else return c.getSimpleName();         } else {            try {               Field f = c.getField("TYPE");               Class d = (Class) f.get(c);               return d.getSimpleName();            } catch (Exception e) {               return c.getSimpleName();            }         }      } else return "";   }