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


Java TypeParameter类代码示例

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


TypeParameter类属于com.github.javaparser.ast包,在下文中一共展示了TypeParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
	JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
	List<ClassOrInterfaceType> extendsList = visit(_n.getExtends(), _arg);
	List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
	List<BodyDeclaration> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
			_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
			_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
	);
	r.setComment(comment);
	return r;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:18,代码来源:CloneVisitor.java

示例4: 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 (!isNullOrEmpty(n.getTypeBound())) {
    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:plum-umd,项目名称:java-sketch,代码行数:21,代码来源:DumpVisitor.java

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

示例6: visit

import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
	JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
	List<ClassOrInterfaceType> extendsList = visit(_n.getExtends(), _arg);
	List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
	List<BodyDeclaration> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
			_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
			_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
	);
	r.setComment(comment);
	return copyExtras(_n, r);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:18,代码来源:CloneVisitor.java

示例7: 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(resolveTypeParamName(n));
    if (!isNullOrEmpty(n.getTypeBound())) {
        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:WeTheInternet,项目名称:xapi,代码行数:23,代码来源:DumpVisitor.java

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

示例9: printTypeParameters

import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public void printTypeParameters(final List<TypeParameter> args, final Object arg) {
    if (!isNullOrEmpty(args)) {
        printer.print("<");
        for (final Iterator<TypeParameter> i = args.iterator(); i.hasNext(); ) {
            final TypeParameter t = i.next();
            t.accept(this, arg);
            if (i.hasNext()) {
                printer.print(", ");
            }
        }
        printer.print(">");
    }
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:14,代码来源:ASTDumpVisitor.java

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

示例11: doMerge

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

    TypeParameter tp = new TypeParameter();
    tp.setName(first.getName());
    tp.setTypeBound(first.getTypeBound());
    tp.setAnnotations(mergeCollections(first.getAnnotations(), second.getAnnotations()));

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

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

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

示例14: ClassOrInterfaceDeclaration

import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public ClassOrInterfaceDeclaration(final int modifiers,
		final List<AnnotationExpr> annotations, final boolean isInterface, final String name,
		final List<TypeParameter> typeParameters, final List<ClassOrInterfaceType> extendsList,
		final List<ClassOrInterfaceType> implementsList, final List<BodyDeclaration> members) {
	super(annotations, modifiers, name, members);
	setInterface(isInterface);
	setTypeParameters(typeParameters);
	setExtends(extendsList);
	setImplements(implementsList);
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:11,代码来源:ClassOrInterfaceDeclaration.java

示例15: ConstructorDeclaration

import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public ConstructorDeclaration(int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters,
                              String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) {
    super(annotations);
    setModifiers(modifiers);
    setTypeParameters(typeParameters);
    setName(name);
    setParameters(parameters);
    setThrows(throws_);
    setBlock(block);
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:11,代码来源:ConstructorDeclaration.java


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