本文整理汇总了Java中com.github.javaparser.ast.expr.VariableDeclarationExpr.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java VariableDeclarationExpr.getAnnotations方法的具体用法?Java VariableDeclarationExpr.getAnnotations怎么用?Java VariableDeclarationExpr.getAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.expr.VariableDeclarationExpr
的用法示例。
在下文中一共展示了VariableDeclarationExpr.getAnnotations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeClone
import com.github.javaparser.ast.expr.VariableDeclarationExpr; //导入方法依赖的package包/类
protected static VariableDeclarationExpr makeClone(VariableDeclarationExpr n) {
VariableDeclarationExpr myclone = new VariableDeclarationExpr(n.getBeginLine(),
n.getBeginColumn(),
n.getEndLine(),
n.getEndColumn(),
n.getModifiers(),
n.getAnnotations(),
n.getType(),
n.getVars());
// Clone class members inherited from Node
myclone.setParentNode(n.getParentNode());
myclone.setData(n.getData());
myclone.setComment(n.getComment());
// Orphan comments should be added one by one
for (final Comment c : n.getOrphanComments()) {
myclone.addOrphanComment(c);
}
return myclone;
}
示例2: visit
import com.github.javaparser.ast.expr.VariableDeclarationExpr; //导入方法依赖的package包/类
@Override public Node visit(final VariableDeclarationExpr n, final A arg) {
final List<AnnotationExpr> annotations = n.getAnnotations();
if (annotations != null) {
for (int i = 0; i < annotations.size(); i++) {
annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
}
removeNulls(annotations);
}
n.setType((Type) n.getType().accept(this, arg));
final List<VariableDeclarator> vars = n.getVars();
for (int i = 0; i < vars.size(); i++) {
vars.set(i, (VariableDeclarator) vars.get(i).accept(this, arg));
}
removeNulls(vars);
return n;
}
示例3: visit
import com.github.javaparser.ast.expr.VariableDeclarationExpr; //导入方法依赖的package包/类
@Override
public final void visit(VariableDeclarationExpr ctx, Object arg) {
final Component cmp = createComponent(ctx, OOPSourceModelConstants.ComponentType.LOCAL);
for (final AnnotationExpr annot : ctx.getAnnotations()) {
populateAnnotation(cmp, annot);
}
cmp.setAccessModifiers(resolveJavaParserModifiers(ctx.getModifiers()));
final List<Component> vars = new ArrayList<Component>();
for (final VariableDeclarator copy : ctx.getVariables()) {
final Component tmp = new Component(cmp);
tmp.setName(copy.getNameAsString());
tmp.setComponentName(generateComponentName(copy.getNameAsString()));
pointParentsToGivenChild(tmp);
vars.add(tmp);
}
for (final Component tmpCmp : vars) {
componentStack.push(tmpCmp);
}
super.visit(ctx, arg);
int numVars = ctx.getVariables().size();
for (int i = 0; i < numVars; i++) {
completeComponent();
}
}
示例4: visit
import com.github.javaparser.ast.expr.VariableDeclarationExpr; //导入方法依赖的package包/类
@Override public Node visit(final VariableDeclarationExpr n, final A arg) {
visitComment(n, arg);
final List<AnnotationExpr> annotations = n.getAnnotations();
if (annotations != null) {
for (int i = 0; i < annotations.size(); i++) {
annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
}
removeNulls(annotations);
}
final Type type = (Type) n.getElementType().accept(this, arg);
if (type == null) {
return null;
}
n.setElementType(type);
final List<VariableDeclarator> vars = n.getVariables();
for (int i = 0; i < vars.size();) {
final VariableDeclarator decl = (VariableDeclarator)
vars.get(i).accept(this, arg);
if (decl == null) {
vars.remove(i);
} else {
vars.set(i++, decl);
}
}
if (vars.isEmpty()) {
return null;
}
return n;
}