Package com.sun.javadoc

Examples of com.sun.javadoc.ParameterizedType


        String typeString = typeQualifiedName;
        if (typeDocFileName != null) {
            typeString = "<A HREF=\"" + typeDocFileName + "\">" + typeString + "</A>";
        }
        if (type.asParameterizedType() != null) {
            ParameterizedType parametrizedType = type.asParameterizedType();
            final Type[] parameterTypes = parametrizedType.typeArguments();
            if (parameterTypes.length > 0) {
                String[] parametersTypeStrings = new String[parameterTypes.length];
                for (int i = 0; i < parameterTypes.length; i++) {
                    parametersTypeStrings[i] = getTypeString(parameterTypes[i]);
                }


        }
      }
    }

    // if parameterized then build map of the param vars
    ParameterizedType pt = type.asParameterizedType();
    if (pt != null) {
      Type[] typeArgs = pt.typeArguments();
      if (typeArgs != null && typeArgs.length > 0) {
        TypeVariable[] vars = classDoc.typeParameters();
        int i = 0;
        for (TypeVariable var : vars) {
          this.varsToTypes.put(var.qualifiedTypeName(), typeArgs[i]);

  private void parseNestedModels(Collection<TypeRef> types) {
    for (TypeRef type : types) {
      parseModel(type.type, true);

      // parse paramaterized types
      ParameterizedType pt = type.type.asParameterizedType();
      if (pt != null) {
        Type[] typeArgs = pt.typeArguments();
        if (typeArgs != null) {
          for (Type paramType : typeArgs) {
            parseModel(paramType, true);
          }
        }

  }

  private Type getModelType(Type type, boolean nested) {
    if (type != null) {

      ParameterizedType pt = type.asParameterizedType();
      if (pt != null) {
        Type[] typeArgs = pt.typeArguments();
        if (typeArgs != null && typeArgs.length > 0) {
          // if its a generic wrapper type then return the wrapped type
          if (this.options.getGenericWrapperTypes().contains(type.qualifiedTypeName())) {
            return typeArgs[0];
          }

   * @param type
   * @return The type to use for the resource method
   */
  public static Type getReturnType(DocletOptions options, Type type) {
    if (type != null) {
      ParameterizedType pt = type.asParameterizedType();
      if (pt != null) {
        Type[] typeArgs = pt.typeArguments();
        if (typeArgs != null && typeArgs.length > 0) {
          // if its a generic wrapper type then return the wrapped type
          if (options.getGenericWrapperTypes().contains(type.qualifiedTypeName())) {
            return typeArgs[0];
          }

   *            will not be handled
   * @return The container type or null if not a collection
   */
  public static Type getContainerType(Type type, Map<String, Type> varsToTypes) {
    Type result = null;
    ParameterizedType pt = type.asParameterizedType();
    if (pt != null && ParserHelper.isCollection(type.qualifiedTypeName())) {
      Type[] typeArgs = pt.typeArguments();
      if (typeArgs != null && typeArgs.length > 0) {
        result = typeArgs[0];
      }
    }
    // if its a ref to a param type replace with the type impl

                        String attributeInfo = "";
                        String attributeType =
                           method.returnType().simpleTypeName();

                        // check if is this a parameterised type
                        ParameterizedType pt =
                           method.returnType().asParameterizedType();
                        if (pt != null && pt.typeArguments().length > 0) {

                           attributeType += "[";
                           for (int i = 0; i < pt.typeArguments().length; i++) {
                              attributeType +=
                                 pt.typeArguments()[i].simpleTypeName();
                              if (i < pt.typeArguments().length - 1) {
                                 attributeType += ", ";
                              }
                           }
                           attributeType += "]";

    */
   public static String getTypeName(final Type type) {

      String typeName = "";
      typeName = type.simpleTypeName();
      ParameterizedType pt = type.asParameterizedType();
      if (pt != null && pt.typeArguments() != null
         && pt.typeArguments().length > 0) {
         typeName += "[";
         for (int i = 0; i < pt.typeArguments().length; i++) {
            typeName += pt.typeArguments()[i].simpleTypeName();
            if (i < pt.typeArguments().length - 1) {
               typeName += ", ";
            }
         }
         typeName += "]";
      }

    // 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);
    }
  }

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

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.