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


Java TypeParameter.getTypeBound方法代码示例

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


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

示例1: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public void visit(final TypeParameter n, final Object arg) {
    printer.printLn("TypeParameter");
    printJavaComment(n.getComment(), arg);
    if (n.getAnnotations() != null) {
        for (AnnotationExpr ann : n.getAnnotations()) {
            ann.accept(this, arg);
            printer.print(" ");
        }
    }
    printer.print(n.getName());
    if (n.getTypeBound() != null) {
        printer.print(" extends ");
        for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
            final ClassOrInterfaceType c = i.next();
            c.accept(this, arg);
            if (i.hasNext()) {
                printer.print(" & ");
            }
        }
    }
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:23,代码来源:ASTDumpVisitor.java

示例2: doIsEquals

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public boolean doIsEquals(TypeParameter first, TypeParameter second) {

    if(!StringUtils.equals(first.getName(),second.getName())) return false;

    List<ClassOrInterfaceType> firstTypeBounds = first.getTypeBound();
    List<ClassOrInterfaceType> secondTypeBounds = second.getTypeBound();

    if(firstTypeBounds == null) return secondTypeBounds == null;
    if(secondTypeBounds == null) return false;

    if(firstTypeBounds.size() != secondTypeBounds.size()) return false;

    AbstractMerger<ClassOrInterfaceType> merger = getMerger(ClassOrInterfaceType.class);

    for(int i = 0; i < firstTypeBounds.size(); i++){
        if(!merger.isEquals(firstTypeBounds.get(i),secondTypeBounds.get(i))){
            return false;
        }
    }

    return true;
}
 
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:24,代码来源:TypeParameterMerger.java

示例3: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override public void visit(final TypeParameter n, final Object arg) {
	printJavaComment(n.getComment(), arg);
	if (n.getAnnotations() != null) {
		for (AnnotationExpr ann : n.getAnnotations()) {
			ann.accept(this, arg);
			printer.print(" ");
		}
	}
	printer.print(n.getName());
	if (n.getTypeBound() != null) {
		printer.print(" extends ");
		for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext();) {
			final ClassOrInterfaceType c = i.next();
			c.accept(this, arg);
			if (i.hasNext()) {
				printer.print(" & ");
			}
		}
	}
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:21,代码来源:DumpVisitor.java

示例4: typeVariableName

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
private TypeVariableName typeVariableName(TypeParameter typeParameter, TypeNameDetermination typeNameDetermination) {
    List<ClassOrInterfaceType> typeBounds = typeParameter.getTypeBound();
    TypeName[] typeNames = typeBounds.stream()
            .map(typeNameDetermination::determineTypeName)
            .toArray(TypeName[]::new);

    return TypeVariableName.get(typeParameter.getName(), typeNames);
}
 
开发者ID:theangrydev,项目名称:fluent-bdd,代码行数:9,代码来源:JavaEmitter.java

示例5: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public JCTree visit(final TypeParameter n, final Object arg) {
    //ARG0: Name name
    Name arg0 = names.fromString(n.getName());

    //ARG1: List<JCExpression> bounds
    List<JCExpression> arg1 = List.<JCExpression>nil();
    if (n.getTypeBound() != null) {
        for (final ClassOrInterfaceType c : n.getTypeBound()) {
            arg1 = arg1.append((JCExpression) c.accept(this, arg));
        }
    }
    return new AJCTypeParameter(make.TypeParameter(arg0, arg1), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:15,代码来源:JavaParser2JCTree.java

示例6: apply

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
public TypeRef apply(TypeParameter item) {
    List<TypeRef> interfaces = new ArrayList<TypeRef>();

    for (ClassOrInterfaceType classOrInterfaceType : item.getTypeBound()) {

    }
    return null;
}
 
开发者ID:sundrio,项目名称:sundrio,代码行数:9,代码来源:TypeParameterToJavaType.java

示例7: apply

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
public TypeParamDef apply(TypeParameter typeParameter) {
    List<ClassRef> bounds = new ArrayList<ClassRef>();
    for (ClassOrInterfaceType classOrInterfaceType : typeParameter.getTypeBound()) {
        bounds.add((ClassRef) CLASS_OR_TYPEPARAM_REF.apply(classOrInterfaceType));
    }
    return new TypeParamDefBuilder()
            .withName(typeParameter.getName())
            .withBounds(bounds)
            .build();
}
 
开发者ID:sundrio,项目名称:sundrio,代码行数:11,代码来源:Sources.java

示例8: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override
public R visit(final TypeParameter n, final A arg) {
	if (n.getTypeBound() != null) {
		for (final ClassOrInterfaceType c : n.getTypeBound()) {
			{
				R result = c.accept(this, arg);
				if (result != null) {
					return result;
				}
			}
		}
	}
	return null;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:15,代码来源:GenericVisitorAdapter.java

示例9: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override public void visit(final TypeParameter n, final A arg) {
	visitComment(n.getComment(), arg);
	if (n.getTypeBound() != null) {
		for (final ClassOrInterfaceType c : n.getTypeBound()) {
			c.accept(this, arg);
		}
	}
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:9,代码来源:VoidVisitorAdapter.java

示例10: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override public void visit(final TypeParameter n, final A arg) {
    jw.write(n); 
    visitComment(n.getComment(), arg);
    if (n.getTypeBound() != null) {
        for (final ClassOrInterfaceType c : n.getTypeBound()) {
            c.accept(this, arg);
        }
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:10,代码来源:JsonVisitorAdapter.java

示例11: visit

import com.github.javaparser.ast.TypeParameter; //导入方法依赖的package包/类
@Override public Node visit(final TypeParameter n, final A arg) {
	final List<ClassOrInterfaceType> typeBound = n.getTypeBound();
	if (typeBound != null) {
		for (int i = 0; i < typeBound.size(); i++) {
			typeBound.set(i, (ClassOrInterfaceType) typeBound.get(i).accept(this, arg));
		}
		removeNulls(typeBound);
	}
	return n;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:11,代码来源:ModifierVisitorAdapter.java

示例12: 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


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