use of com.github.javaparser.ast.body.VariableDeclarator in project javaparser by javaparser.
the class VoidVisitorAdapter method visit.
@Override
public void visit(final FieldDeclaration 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);
}
}
n.getType().accept(this, arg);
for (final VariableDeclarator var : n.getVariables()) {
var.accept(this, arg);
}
}
use of com.github.javaparser.ast.body.VariableDeclarator in project javaparser by javaparser.
the class CloneVisitor method visit.
@Override
public Node visit(VariableDeclarationExpr _n, Object _arg) {
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
Type type_ = cloneNodes(_n.getType(), _arg);
List<VariableDeclarator> vars = visit(_n.getVars(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclarationExpr r = new VariableDeclarationExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, type_, vars);
r.setComment(comment);
return r;
}
use of com.github.javaparser.ast.body.VariableDeclarator in project javaparser by javaparser.
the class CloneVisitor method visit.
@Override
public Node visit(VariableDeclarator _n, Object _arg) {
VariableDeclaratorId id = cloneNodes(_n.getId(), _arg);
Expression init = cloneNodes(_n.getInit(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclarator r = new VariableDeclarator(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), id, init);
r.setComment(comment);
return r;
}
use of com.github.javaparser.ast.body.VariableDeclarator in project javaparser by javaparser.
the class CloneVisitor method visit.
@Override
public Node visit(FieldDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
Type type_ = cloneNodes(_n.getType(), _arg);
List<VariableDeclarator> variables = visit(_n.getVariables(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
FieldDeclaration r = new FieldDeclaration(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, type_, variables);
r.setComment(comment);
return r;
}
use of com.github.javaparser.ast.body.VariableDeclarator in project javaparser by javaparser.
the class ASTHelper method createFieldDeclaration.
/**
* Creates a {@link FieldDeclaration}.
*
* @param modifiers
* modifiers
* @param type
* type
* @param name
* field name
* @return instance of {@link FieldDeclaration}
*/
public static FieldDeclaration createFieldDeclaration(int modifiers, Type type, String name) {
VariableDeclaratorId id = new VariableDeclaratorId(name);
VariableDeclarator variable = new VariableDeclarator(id);
return createFieldDeclaration(modifiers, type, variable);
}
Aggregations