private void printOutputGenericType(Type type) { String link = null; if (!type.isPrimitive()) { link = Utils.getExternalLink(configuration.parentConfiguration, type, writer); } if (link == null) { print(type.qualifiedTypeName()); } else { around("a href='" + link + "'", type.typeName()); } ParameterizedType pType = type.asParameterizedType(); if (pType != null) { boolean first = true; print("<"); for (Type genericType : pType.typeArguments()) { if (first) { first = false; } else { print(","); } printOutputGenericType(genericType); } print(">"); } print(type.dimension()); }
public ResourceMethod(MethodDoc method, MethodDoc declaringMethod, ResourceClass resource) { this.resource = resource; this.method = method; this.declaringClass = resource.getDeclaringClass(); this.declaringMethod = declaringMethod; this.output = new MethodOutput(declaringMethod); try { formClass = Class.forName("org.jboss.resteasy.annotations.Form"); } catch (ClassNotFoundException e) { // we won't support @Form } setupPath(); setupParameters(); setupMethods(); setupMIMEs(); // is this a resource locator? if (methods.isEmpty() && !declaringMethod.returnType().isPrimitive()) { // Handle Class style resource locator factory methods Type t = declaringMethod.returnType(); if ("java.lang.Class".equals(t.qualifiedTypeName())) { ParameterizedType p = t.asParameterizedType(); if (p != null) { t = p.typeArguments()[0]; } } resourceLocator = new ResourceClass(t.asClassDoc(), this); } }
/** Print a a basic type t */ private String type(Options opt, Type t) { String type = ""; if (opt.showQualified) type = t.qualifiedTypeName(); else type = t.typeName(); type += typeParameters(opt, t.asParameterizedType()); return type; }
/** * Parses a type definition * * @param type * @return */ protected static TypeInfo ParseType(Type type) { TypeInfo typeInfo = new TypeInfo(); typeInfo.qualifiedName = type.qualifiedTypeName(); typeInfo.dimension = type.dimension(); typeInfo.wildcard = ParseWildCard(type.asWildcardType()); typeInfo.generics = ParseGenerics(type.asParameterizedType()); return typeInfo; }
public static Type getCollectionType(Type type, JAXDoclet<?> doclet) { Type collectionType = Utils.findSuperType(type, "java.util.Collection"); // FIXME: this is dodgy at best if (collectionType != null) { ParameterizedType parameterizedType = type.asParameterizedType(); Type[] types = parameterizedType == null ? null : parameterizedType.typeArguments(); if (types != null && types.length == 1) return types[0]; return doclet.forName("java.lang.Object"); } return type; }