Exemplo n.º 1
0
  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());
  }
Exemplo n.º 2
0
 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);
   }
 }
Exemplo n.º 3
0
 /** 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;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 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;
 }