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


Java VariableDeclarationExpr.getAnnotations方法代码示例

本文整理汇总了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;
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:21,代码来源:ComplyToJCVisitor.java

示例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;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:17,代码来源:ModifierVisitorAdapter.java

示例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();
    }
}
 
开发者ID:Zir0-93,项目名称:clarpse,代码行数:30,代码来源:JavaTreeListener.java

示例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;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:33,代码来源:ModifierVisitorAdapter.java


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