Search in sources :

Example 6 with TypeParameter

use of com.github.javaparser.ast.TypeParameter in project javaparser by javaparser.

the class DumpVisitor method printTypeParameters.

private 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(">");
    }
}
Also used : TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 7 with TypeParameter

use of com.github.javaparser.ast.TypeParameter in project javaparser by javaparser.

the class CloneVisitor method visit.

@Override
public Node visit(ConstructorDeclaration _n, Object _arg) {
    JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
    List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
    List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
    List<Parameter> parameters = visit(_n.getParameters(), _arg);
    List<NameExpr> throws_ = visit(_n.getThrows(), _arg);
    BlockStmt block = cloneNodes(_n.getBlock(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);
    ConstructorDeclaration r = new ConstructorDeclaration(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, typeParameters, _n.getName(), parameters, throws_, block);
    r.setComment(comment);
    return r;
}
Also used : JavadocComment(com.github.javaparser.ast.comments.JavadocComment) BlockComment(com.github.javaparser.ast.comments.BlockComment) LineComment(com.github.javaparser.ast.comments.LineComment) Comment(com.github.javaparser.ast.comments.Comment) TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter) JavadocComment(com.github.javaparser.ast.comments.JavadocComment) ConstructorDeclaration(com.github.javaparser.ast.body.ConstructorDeclaration) Parameter(com.github.javaparser.ast.body.Parameter) TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 8 with TypeParameter

use of com.github.javaparser.ast.TypeParameter in project javaparser by javaparser.

the class CloneVisitor method visit.

@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;
}
Also used : JavadocComment(com.github.javaparser.ast.comments.JavadocComment) BlockComment(com.github.javaparser.ast.comments.BlockComment) LineComment(com.github.javaparser.ast.comments.LineComment) Comment(com.github.javaparser.ast.comments.Comment) TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter) JavadocComment(com.github.javaparser.ast.comments.JavadocComment) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) BodyDeclaration(com.github.javaparser.ast.body.BodyDeclaration)

Aggregations

TypeParameter (com.github.javaparser.ast.TypeParameter)8 MultiTypeParameter (com.github.javaparser.ast.body.MultiTypeParameter)8 Parameter (com.github.javaparser.ast.body.Parameter)4 BlockComment (com.github.javaparser.ast.comments.BlockComment)4 Comment (com.github.javaparser.ast.comments.Comment)4 JavadocComment (com.github.javaparser.ast.comments.JavadocComment)4 LineComment (com.github.javaparser.ast.comments.LineComment)4 BodyDeclaration (com.github.javaparser.ast.body.BodyDeclaration)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 ConstructorDeclaration (com.github.javaparser.ast.body.ConstructorDeclaration)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1