Package com.sun.javadoc

Examples of com.sun.javadoc.ParameterizedType


        around("span title='" + type.qualifiedTypeName() + "'", type.simpleTypeName());
      } else {
        around("a title='" + fDoc.qualifiedTypeName() + "' href='" + Utils.urlToClass(cDoc, fDoc) + "'", fDoc.simpleTypeName());
      }
    }
    ParameterizedType pType = type.asParameterizedType();
    if (pType != null) {
      boolean first = true;
      print("<");
      for (Type genericType : pType.typeArguments()) {
        if (first) {
          first = false;
        } else {
          print(",");
        }


    types.add(field.type());
      }
  }
  // see if there are some type parameters
  if (c.asParameterizedType() != null) {
      ParameterizedType pt = c.asParameterizedType();
      types.addAll(Arrays.asList(pt.typeArguments()));
  }
  // see if type parameters extend something
  for(TypeVariable tv: c.typeParameters()) {
      if(tv.bounds().length > 0 )
    types.addAll(Arrays.asList(tv.bounds()));

  return new FieldRelationInfo(type.asClassDoc(), false);
    }
   
    private Type[] getInterfaceTypeArguments(ClassDoc iface, Type t) {
  if (t instanceof ParameterizedType) {
      ParameterizedType pt = (ParameterizedType) t;
      if (iface.equals(t.asClassDoc())) {
    return pt.typeArguments();
      } else {
    for (Type pti : pt.interfaceTypes()) {
        Type[] result = getInterfaceTypeArguments(iface, pti);
        if (result != null)
      return result;
    }
    if (pt.superclassType() != null)
        return getInterfaceTypeArguments(iface, pt.superclassType());
      }
  } else if (t instanceof ClassDoc) {
      ClassDoc cd = (ClassDoc) t;
      for (Type pti : cd.interfaceTypes()) {
    Type[] result = getInterfaceTypeArguments(iface, pti);

    types.add(field.type());
      }
  }
  // see if there are some type parameters
  if (c.asParameterizedType() != null) {
      ParameterizedType pt = c.asParameterizedType();
      types.addAll(Arrays.asList(pt.typeArguments()));
  }
  // see if type parameters extend something
  for(TypeVariable tv: c.typeParameters()) {
      if(tv.bounds().length > 0 )
    types.addAll(Arrays.asList(tv.bounds()));

  return new FieldRelationInfo(type.asClassDoc(), false);
    }
   
    private Type[] getInterfaceTypeArguments(ClassDoc iface, Type t) {
  if (t instanceof ParameterizedType) {
      ParameterizedType pt = (ParameterizedType) t;
      if (iface != null && iface.equals(t.asClassDoc())) {
    return pt.typeArguments();
      } else {
    for (Type pti : pt.interfaceTypes()) {
        Type[] result = getInterfaceTypeArguments(iface, pti);
        if (result != null)
      return result;
    }
    if (pt.superclassType() != null)
        return getInterfaceTypeArguments(iface, pt.superclassType());
      }
  } else if (t instanceof ClassDoc) {
      ClassDoc cd = (ClassDoc) t;
      for (Type pti : cd.interfaceTypes()) {
    Type[] result = getInterfaceTypeArguments(iface, pti);

    Map<String, cc.catalysts.cdoclet.generator.Type> bounds = new HashMap<String, cc.catalysts.cdoclet.generator.Type>();
    Collection<cc.catalysts.cdoclet.generator.Type> arguments = new ArrayList<cc.catalysts.cdoclet.generator.Type>();

    if (type instanceof ParameterizedType) {
      ParameterizedType parameterizedType = type.asParameterizedType();
      logger.debug("Arguments {}", Arrays.toString(parameterizedType.typeArguments()));
      for (Type argument : parameterizedType.typeArguments()) {
        processArgument(argument, generator, arguments, bounds, ignore, visited);
      }
    } else if (type instanceof ClassDoc) {
      ClassDoc classDoc = type.asClassDoc();
      logger.debug("Parameters {}", Arrays.toString(classDoc.typeParameters()));

  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;

    Map<String, cc.catalysts.cdoclet.generator.Type> bounds = new HashMap<String, cc.catalysts.cdoclet.generator.Type>();
    Collection<cc.catalysts.cdoclet.generator.Type> arguments = new ArrayList<cc.catalysts.cdoclet.generator.Type>();

    if (type instanceof ParameterizedType) {
      ParameterizedType parameterizedType = type.asParameterizedType();
      logger.debug("Arguments {}", Arrays.toString(parameterizedType.typeArguments()));
      for (Type argument : parameterizedType.typeArguments()) {
        processArgument(argument, generator, arguments, bounds, ignore, visited);
      }
    } else if (type instanceof ClassDoc) {
      ClassDoc classDoc = type.asClassDoc();
      logger.debug("Parameters {}", Arrays.toString(classDoc.typeParameters()));

TOP

Related Classes of com.sun.javadoc.ParameterizedType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.