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


Java TypeParameter.getName方法代码示例

本文整理汇总了Java中com.github.javaparser.ast.TypeParameter.getName方法的典型用法代码示例。如果您正苦于以下问题:Java TypeParameter.getName方法的具体用法?Java TypeParameter.getName怎么用?Java TypeParameter.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.javaparser.ast.TypeParameter的用法示例。


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

示例1: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public Node visit(TypeParameter _n, Object _arg) {
       List<ClassOrInterfaceType> typeBound = visit(_n.getTypeBound(), _arg);

       List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
       TypeParameter r = new TypeParameter(_n.getBeginLine(),
               _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
               _n.getName(), typeBound, annotations);

       Comment comment = cloneNodes(_n.getComment(), _arg);
       r.setComment(comment);
	return r;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:14,代码来源:CloneVisitor.java

示例2: absorb

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
public String absorb(TypeParameter type) {
    // TODO Only ever allow greater specificity in updates,
    // so it is legal to make bounds tighter, but never looser
    // Legal: Type<T> -> Type<T extends List>
    // Legal: Type<T> -> Type<T, V>
    // Illegal: Type<T extends List> -> Type<T>
    // TODO: consider whether it should be legal to remove types.  Probably not,
    // since isolated modules would want to add only names they know about,
    // so, absorbing a type parameter should never accidentally erase a type requested elsewhere.
    this.type.setTypeBound(type.getTypeBound());
    this.type.setName(type.getName());
    return type.getName();
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:14,代码来源:GeneratedTypeParameter.java

示例3: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public Node visit(TypeParameter _n, Object _arg) {
       List<ClassOrInterfaceType> typeBound = visit(_n.getTypeBound(), _arg);

       List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
       TypeParameter r = new TypeParameter(_n.getBeginLine(),
               _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
               _n.getName(), typeBound, annotations);

       Comment comment = cloneNodes(_n.getComment(), _arg);
       r.setComment(comment);
	return copyExtras(_n, r);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:14,代码来源:CloneVisitor.java

示例4: getJavaType

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
/**
 * Resolves the effective {@link JavaType} a
 * {@link ClassOrInterfaceDeclaration} represents, including any type
 * parameters.
 * 
 * @param compilationUnitService for package management (required)
 * @param typeDeclaration the type declaration to resolve (required)
 * @return the effective Java type (never null)
 */
public static JavaType getJavaType(
        final CompilationUnitService compilationUnitService,
        final TypeDeclaration typeDeclaration) {
    Validate.notNull(compilationUnitService,
            "Compilation unit services required");
    Validate.notNull(typeDeclaration, "Type declaration required");

    // Convert the ClassOrInterfaceDeclaration name into a JavaType
    final NameExpr nameExpr = getNameExpr(typeDeclaration.getName());
    final JavaType effectiveType = getJavaType(compilationUnitService,
            nameExpr, null);

    final List<JavaType> parameterTypes = new ArrayList<JavaType>();
    if (typeDeclaration instanceof ClassOrInterfaceDeclaration) {
        final ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) typeDeclaration;
        // Populate JavaType with type parameters
        final List<TypeParameter> typeParameters = clazz
                .getTypeParameters();
        if (typeParameters != null) {
            final Set<JavaSymbolName> locatedTypeParameters = new HashSet<JavaSymbolName>();
            for (final TypeParameter candidate : typeParameters) {
                final JavaSymbolName currentTypeParam = new JavaSymbolName(
                        candidate.getName());
                locatedTypeParameters.add(currentTypeParam);
                JavaType javaType = null;
                if (candidate.getTypeBound() == null) {
                    javaType = new JavaType(
                        JavaType.OBJECT.getFullyQualifiedTypeName(), 0,
                            DataType.TYPE, currentTypeParam, null);
                }
                else {
                    final ClassOrInterfaceType cit = candidate
                            .getTypeBound().get(0);
                    javaType = JavaParserUtils.getJavaTypeNow(
                        compilationUnitService, cit,
                            locatedTypeParameters);
                    javaType = new JavaType(
                            javaType.getFullyQualifiedTypeName(),
                            javaType.getArray(), javaType.getDataType(),
                            currentTypeParam, javaType.getParameters());
                }
                parameterTypes.add(javaType);
            }
        }
    }

    return new JavaType(effectiveType.getFullyQualifiedTypeName(),
            effectiveType.getArray(), effectiveType.getDataType(), null,
            parameterTypes);
}
 
开发者ID:BenDol,项目名称:Databind,代码行数:60,代码来源:JavaParserUtils.java

示例5: resolveTypeParamName

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
public String resolveTypeParamName(TypeParameter param) {
  return param.getName();
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:4,代码来源:Transformer.java

示例6: resolveTypeParamName

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
/**
 * Purposely does not handle bounds; this will be invoked for
 * all bounded type arguments (allowing you to perform modifications
 * as you see fit).
 */
protected String resolveTypeParamName(TypeParameter typeParam) {
    return typeParam.getName();
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:9,代码来源:DumpVisitor.java


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