Search in sources :

Example 1 with TypeParameter

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

the class DumpVisitor method visit.

@Override
public void visit(MethodReferenceExpr n, Object arg) {
    printJavaComment(n.getComment(), arg);
    Expression scope = n.getScope();
    String identifier = n.getIdentifier();
    if (scope != null) {
        n.getScope().accept(this, arg);
    }
    printer.print("::");
    if (n.getTypeParameters() != null) {
        printer.print("<");
        for (Iterator<TypeParameter> i = n.getTypeParameters().iterator(); i.hasNext(); ) {
            TypeParameter p = i.next();
            p.accept(this, arg);
            if (i.hasNext()) {
                printer.print(", ");
            }
        }
        printer.print(">");
    }
    if (identifier != null) {
        printer.print(identifier);
    }
}
Also used : TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 2 with TypeParameter

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

the class VoidVisitorAdapter method visit.

@Override
public void visit(final ConstructorDeclaration n, final A arg) {
    visitComment(n.getComment(), arg);
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (final AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getTypeParameters() != null) {
        for (final TypeParameter t : n.getTypeParameters()) {
            t.accept(this, arg);
        }
    }
    if (n.getParameters() != null) {
        for (final Parameter p : n.getParameters()) {
            p.accept(this, arg);
        }
    }
    if (n.getThrows() != null) {
        for (final NameExpr name : n.getThrows()) {
            name.accept(this, arg);
        }
    }
    n.getBlock().accept(this, arg);
}
Also used : TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter) TypeParameter(com.github.javaparser.ast.TypeParameter) Parameter(com.github.javaparser.ast.body.Parameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 3 with TypeParameter

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

the class VoidVisitorAdapter method visit.

@Override
public void visit(final MethodDeclaration n, final A arg) {
    visitComment(n.getComment(), arg);
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (final AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getTypeParameters() != null) {
        for (final TypeParameter t : n.getTypeParameters()) {
            t.accept(this, arg);
        }
    }
    n.getType().accept(this, arg);
    if (n.getParameters() != null) {
        for (final Parameter p : n.getParameters()) {
            p.accept(this, arg);
        }
    }
    if (n.getThrows() != null) {
        for (final NameExpr name : n.getThrows()) {
            name.accept(this, arg);
        }
    }
    if (n.getBody() != null) {
        n.getBody().accept(this, arg);
    }
}
Also used : TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter) TypeParameter(com.github.javaparser.ast.TypeParameter) Parameter(com.github.javaparser.ast.body.Parameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 4 with TypeParameter

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

the class CloneVisitor method visit.

@Override
public Node visit(MethodDeclaration _n, Object _arg) {
    JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
    List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
    List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
    Type type_ = cloneNodes(_n.getType(), _arg);
    List<Parameter> parameters = visit(_n.getParameters(), _arg);
    List<NameExpr> throws_ = visit(_n.getThrows(), _arg);
    BlockStmt block = cloneNodes(_n.getBody(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);
    MethodDeclaration r = new MethodDeclaration(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, typeParameters, type_, _n.getName(), parameters, _n.getArrayCount(), 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) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) JavadocComment(com.github.javaparser.ast.comments.JavadocComment) Parameter(com.github.javaparser.ast.body.Parameter) TypeParameter(com.github.javaparser.ast.TypeParameter) MultiTypeParameter(com.github.javaparser.ast.body.MultiTypeParameter)

Example 5 with TypeParameter

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

the class CloneVisitor method visit.

@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;
}
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)

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