当前位置: 首页>>代码示例>>Java>>正文


Java TypeVariable类代码示例

本文整理汇总了Java中com.sun.javadoc.TypeVariable的典型用法代码示例。如果您正苦于以下问题:Java TypeVariable类的具体用法?Java TypeVariable怎么用?Java TypeVariable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeVariable类属于com.sun.javadoc包,在下文中一共展示了TypeVariable类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parameterLink

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
/**
 * Appends to the current document the given type parameter
 * as a valid markdown link.
 * 
 * @param source Source package to start URL from.
 * @param type Target type parameter to reach from this package.
 */
private void parameterLink(final PackageDoc source, final Type type) {
	final WildcardType wildcard = type.asWildcardType();
	if (wildcard != null) {
		character('?');
	}
	else {
		final TypeVariable variableType = type.asTypeVariable();
		if (variableType != null) {
			final Type [] bounds = variableType.bounds();
			if (bounds.length > 0) {
				text("? extends ");
				for (int i = 0; i < bounds.length; i++) {
					typeLink(source, bounds[i]);
					if (i < bounds.length - 1) {
						text(" & ");
					}
				}
			}
		}
		else {
			typeLink(source, type);
		}
	}
}
 
开发者ID:Faylixe,项目名称:marklet,代码行数:32,代码来源:MarkletDocumentBuilder.java

示例2: parseIdentifier

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
private String parseIdentifier(Type type) {
  if (type instanceof TypeVariable) {
    return parseIdentifier((Doc) type.asClassDoc()) + "#" + type.simpleTypeName();
  } else {
    return parseIdentifier((Doc) type.asClassDoc());
  }
}
 
开发者ID:riptano,项目名称:xml-doclet,代码行数:8,代码来源:Parser.java

示例3: parseGeneric

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
/**
 * Parse type variables for generics
 * 
 * @param typeVariable
 * @return
 */
protected Generic parseGeneric(TypeVariable typeVariable) {
  Generic genericNode = objectFactory.createGeneric();
  genericNode.setName(typeVariable.typeName());
  genericNode.setIdentifier(parseIdentifier((Type) typeVariable));
  genericNode.setId(typeVariable.simpleTypeName());

  for (Type bound : typeVariable.bounds()) {
    genericNode.getBound().add(parseTypeInfo(bound));
  }

  return genericNode;
}
 
开发者ID:riptano,项目名称:xml-doclet,代码行数:19,代码来源:Parser.java

示例4: processTypeVariables

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
/**
 * @return full JSON objects for the given TypeVariable[]
 */
protected JSONArray processTypeVariables( TypeVariable[] typeVariables) {
    
    JSONArray retMe = new JSONArray();
    
    for (TypeVariable typeVariable : typeVariables) {
        retMe.add( processTypeVariable(typeVariable) );
    }
    
    return retMe;
}
 
开发者ID:rob4lderman,项目名称:javadoc-json-doclet,代码行数:14,代码来源:JsonDoclet.java

示例5: processTypeVariable

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
/**
 * 
 * @return the full JSON for the given TypeVariable
 */
protected JSONObject processTypeVariable(TypeVariable typeVariable) {
    if (typeVariable == null) {
        return null;
    }
    
    JSONObject retMe = processType(typeVariable);
    
    retMe.put("bounds", processTypes(typeVariable.bounds()));
    
    return retMe;
}
 
开发者ID:rob4lderman,项目名称:javadoc-json-doclet,代码行数:16,代码来源:JsonDoclet.java

示例6: sameName

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
private boolean sameName(String name, TypeVariable type)
{
    if (name == null || type == null)
    {
        return true;
    }
    if (type.asClassDoc() == null || type.asClassDoc().name() == null)
    {
        return true;
    }
    return name.equals(type.asClassDoc().name());
}
 
开发者ID:tcolar,项目名称:javaontracks,代码行数:13,代码来源:JOTDocletNavView.java

示例7: parseInterface

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
protected Interface parseInterface(ClassDoc classDoc) {

    Interface interfaceNode = objectFactory.createInterface();
    interfaceNode.setName(classDoc.name());
    interfaceNode.setDisplayName(classDoc.simpleTypeName());
    interfaceNode.setIdentifier(parseIdentifier((Doc) classDoc));
    interfaceNode.setFull(classDoc.qualifiedName());
    interfaceNode.setComment(parseComment(classDoc));
    interfaceNode.setScope(parseScope(classDoc));

    for (TypeVariable typeVariable : classDoc.typeParameters()) {
      interfaceNode.getGeneric().add(parseGeneric(typeVariable));
    }

    for (Type interfaceType : classDoc.interfaceTypes()) {
      interfaceNode.getInterface().add(parseTypeInfo(interfaceType));
    }

    for (MethodDoc method : classDoc.methods()) {
      interfaceNode.getMethod().add(parseMethod(method));
    }

    Tag[] tags;
    SeeTag[] seeTags;

    tags = classDoc.tags("@deprecated");
    if (tags.length > 0) {
      interfaceNode.setDeprecated(parseComment(tags[0]));
    }

    tags = classDoc.tags("@since");
    if (tags.length > 0) {
      interfaceNode.setSince(tags[0].text());
    }

    tags = classDoc.tags("@version");
    if (tags.length > 0) {
      interfaceNode.setVersion(tags[0].text());
    }

    seeTags = classDoc.seeTags();
    for (int i = 0; i < seeTags.length; i++) {
      interfaceNode.getLink().add(parseLink(seeTags[i]));
    }

    return interfaceNode;
  }
 
开发者ID:riptano,项目名称:xml-doclet,代码行数:48,代码来源:Parser.java

示例8: parseClass

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
protected Class parseClass(ClassDoc classDoc) {

    Class classNode = objectFactory.createClass();
    classNode.setName(classDoc.name());
    classNode.setDisplayName(classDoc.simpleTypeName());
    classNode.setIdentifier(parseIdentifier((Doc) classDoc));
    classNode.setFull(classDoc.qualifiedName());
    classNode.setComment(parseComment(classDoc));
    classNode.setAbstract(classDoc.isAbstract());
    classNode.setError(classDoc.isError());
    classNode.setException(classDoc.isException());
    classNode.setExternalizable(classDoc.isExternalizable());
    classNode.setSerializable(classDoc.isSerializable());
    classNode.setScope(parseScope(classDoc));

    for (TypeVariable typeVariable : classDoc.typeParameters()) {
      classNode.getGeneric().add(parseGeneric(typeVariable));
    }

    Type superClassType = classDoc.superclassType();
    if (superClassType != null) {
      classNode.setClazz(parseTypeInfo(superClassType));
    }

    for (Type interfaceType : classDoc.interfaceTypes()) {
      classNode.getInterface().add(parseTypeInfo(interfaceType));
    }

    for (MethodDoc method : classDoc.methods()) {
      classNode.getMethod().add(parseMethod(method));
    }

    for (ConstructorDoc constructor : classDoc.constructors()) {
      classNode.getConstructor().add(parseConstructor(constructor));
    }

    for (FieldDoc field : classDoc.fields()) {
      classNode.getField().add(parseField(field));
    }

    Tag[] tags;
    SeeTag[] seeTags;

    tags = classDoc.tags("@deprecated");
    if (tags.length > 0) {
      classNode.setDeprecated(parseComment(tags[0]));
    }

    tags = classDoc.tags("@since");
    if (tags.length > 0) {
      classNode.setSince(tags[0].text());
    }

    tags = classDoc.tags("@version");
    if (tags.length > 0) {
      classNode.setVersion(tags[0].text());
    }

    tags = classDoc.tags("@author");
    for (int i = 0; i < tags.length; i++) {
      classNode.getAuthor().add(tags[i].text());
    }

    seeTags = classDoc.seeTags();
    for (int i = 0; i < seeTags.length; i++) {
      classNode.getLink().add(parseLink(seeTags[i]));
    }

    return classNode;
  }
 
开发者ID:riptano,项目名称:xml-doclet,代码行数:71,代码来源:Parser.java

示例9: start

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
public static boolean start(RootDoc root) throws IOException {
        Map<String, List<String>> packageMap = new TreeMap<>();

        for (ClassDoc classDoc : root.classes()) {
            String fromPackage = classDoc.containingPackage().name();
            List<String> packageRefs = packageMap.get(fromPackage);
            if (packageRefs == null) {
                packageRefs = new LinkedList<String>();
                packageMap.put(fromPackage, packageRefs);
            }
            Set<ClassDoc> relatedClasses = new TreeSet<>();

            addIfPresent(relatedClasses, classDoc.superclass());
            addIfPresent(relatedClasses, classDoc.containingClass());
            addIfPresent(relatedClasses, classDoc.interfaces());

            //TODO: This may not do what I think it does
            for (TypeVariable typeVariable : classDoc.typeParameters()) {
                for (Type bound : typeVariable.bounds()) {
                    System.out.print("Found bound parameter: " + bound.toString());
                    addIfPresent(relatedClasses, bound.asClassDoc());
                }
            }

//            boolean relationsFound = false;
            for (ClassDoc relatedClass : relatedClasses) {
                String toPackage = relatedClass.containingPackage().name();
                if (toPackage.startsWith("org.apache") && !toPackage.equals(fromPackage)) {
                    packageRefs.add(toPackage);
//                    WRITER.write(String.format("\"%s\" -> \"%s\";\n", fromName, toName));
//                    relationsFound = true;
                }
            };
//            if (!relationsFound) {
//                WRITER.write(String.format("\"%s\";\n", fromName)); //single node
//            }

        }

        //write out package links
        for (String fromPackageName : packageMap.keySet()) {
            List<String> toPackageList = packageMap.get(fromPackageName);
            if (toPackageList.isEmpty()) {
                WRITER.write(String.format("\"%s\";\n", fromPackageName)); //single node
                continue;
            }

            //get the packages and number of times they occur
            Map<String, Long> toPackageCounts = toPackageList.stream()
                    .collect(
                            Collectors.groupingBy(p -> p,
                                    Collectors.counting())
                    );

            for (String toPackageName : toPackageCounts.keySet()) {
                WRITER.write(String.format("\"%s\" -> \"%s\" [weight=\"%d\"]\n",
                        fromPackageName, toPackageName,
                        toPackageCounts.get(toPackageName)));
            }

        }

        return true;
    }
 
开发者ID:arafalov,项目名称:Solr-Javadoc,代码行数:65,代码来源:Analyzer.java

示例10: renderOn

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
@Override
public void renderOn(HtmlCanvas html) throws IOException {
    if (type.isPrimitive()) {
        html.write(type.typeName() + type.dimension());
    } else {
        String name;
        ClassDoc classDoc = type.asClassDoc();
        DocReferenceable referenceable = generator.getRefLocator().getClassDocRef(classDoc);
        String ref = PageRenderer.getPage(html).getReferenceTo(referenceable);
        if ((flags & FQN) != 0) {
            name = classDoc.qualifiedName();
        } else {
            name = referenceable.getName();
        }
        if ((flags & LINK) != 0 && ref != null) {
            html.a(href(PageRenderer.getPage(html).getReferenceTo(referenceable))).content(name,
                    HtmlCanvas.NO_ESCAPE);
        } else {
            html.write(name);
        }
    }

    ParameterizedType parameterizedType = type.asParameterizedType();
    if (parameterizedType != null) {
        Type[] typeArguments = parameterizedType.typeArguments();
        if (typeArguments.length > 0) {
            html.write("<");
            for (int typeVarCount = 0; typeVarCount < typeArguments.length; typeVarCount++) {
                Type typeArgument = typeArguments[typeVarCount];
                if (typeVarCount > 0) {
                    html.write(", ");
                }
                renderReferenceable(generator.getRefLocator().getClassDocRef(typeArgument.asClassDoc()), html);
            }
            html.write(">");
        }
    } else if (!type.isPrimitive()) {
        TypeVariable[] typeVariables = type.asClassDoc().typeParameters();
        if (typeVariables.length > 0) {
            html.write("<");
            for (int typeVarCount = 0; typeVarCount < typeVariables.length; typeVarCount++) {
                TypeVariable typeVariable = typeVariables[typeVarCount];
                if (typeVarCount > 0) {
                    html.write(", ");
                }
                html.write(typeVariable.typeName());
                if ((flags & BOUNDS) != 0) {
                    Type[] bounds = typeVariable.bounds();
                    if (bounds.length > 0) {
                        html.write(" extends ");
                        for (int boundCnt = 0; boundCnt < bounds.length; boundCnt++) {
                            ClassDoc boundClass = bounds[boundCnt].asClassDoc();
                            if (boundCnt > 0) {
                                html.write(" & ");
                            }
                            renderReferenceable(generator.getRefLocator().getClassDocRef(boundClass), html);
                        }
                    }
                }
            }
            html.write(">");
        }
    }
}
 
开发者ID:nicolaschriste,项目名称:docdown,代码行数:65,代码来源:ClassNameRenderable.java

示例11: toTypeParametersNode

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
/**
 * Generates a child node for each generic type parameter.
 * @param  doc [description]
 * @return     [description]
 */
private static XMLNode toTypeParametersNode(ClassDoc doc) {
  TypeVariable[] typeParameters = doc.typeParameters();
  ParamTag[] typeParameterTags = doc.typeParamTags();

  XMLNode node = null;

  if (typeParameters != null && typeParameters.length > 0) {
    node = new XMLNode("typeParameters");

    for (TypeVariable i : typeParameters) {
      XMLNode paramNode = new XMLNode("parameter");
      paramNode.attribute("name", i.typeName());

      Type[] bounds = i.bounds();

      if (bounds != null && bounds.length > 0) {
        XMLNode boundsNode = new XMLNode("bounds");

        for (Type t : bounds) {
          XMLNode typeNode = new XMLNode("type");

          typeNode.attribute("fulltype", t.toString());
          typeNode.attribute("type", t.typeName());
          typeNode.attribute("name", t.qualifiedTypeName());

          boundsNode.child(typeNode);
        }

        paramNode.child(boundsNode);
      }

      if (typeParameterTags != null && typeParameterTags.length > 0) {
        ParamTag tag = null;

        for (ParamTag j : typeParameterTags) {
          // take the first one
          if (j.isTypeParameter() && j.parameterName().equals(i.typeName())) {
            tag = j;
            break;
          }
        }

        if (tag != null) {
          XMLNode commentNode = new XMLNode("comment");
          commentNode.text(toComment(tag));
          paramNode.child(commentNode);
        }
      }

      node.child(paramNode);
    }
  }

  return node;
}
 
开发者ID:bazooka,项目名称:bazooka-wo-xmldoclet,代码行数:61,代码来源:XMLDoclet.java

示例12: asTypeVariable

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
public TypeVariable asTypeVariable() { return null; } 
开发者ID:cfriedt,项目名称:classpath,代码行数:2,代码来源:ClassDocReflectedImpl.java

示例13: typeParameters

import com.sun.javadoc.TypeVariable; //导入依赖的package包/类
public TypeVariable[] typeParameters() { return new TypeVariable[0]; } 
开发者ID:cfriedt,项目名称:classpath,代码行数:2,代码来源:ClassDocReflectedImpl.java


注:本文中的com.sun.javadoc.TypeVariable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。