本文整理汇总了Java中org.walkmod.javalang.ast.expr.NormalAnnotationExpr类的典型用法代码示例。如果您正苦于以下问题:Java NormalAnnotationExpr类的具体用法?Java NormalAnnotationExpr怎么用?Java NormalAnnotationExpr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NormalAnnotationExpr类属于org.walkmod.javalang.ast.expr包,在下文中一共展示了NormalAnnotationExpr类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, Object arg) {
prepareComments(n);
printPreviousComments(n, arg);
printer.print("@");
n.getName().accept(this, arg);
printer.print("(");
if (n.getPairs() != null) {
for (Iterator<MemberValuePair> i = n.getPairs().iterator(); i.hasNext();) {
MemberValuePair m = i.next();
m.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(")");
}
示例2: NormalAnnotation
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
final public NormalAnnotationExpr NormalAnnotation() throws ParseException {
NameExpr name;
List pairs = null;
int line;
int column;
jj_consume_token(AT);
line = token.beginLine;
column = token.beginColumn;
name = Name();
jj_consume_token(LPAREN);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case IDENTIFIER:
pairs = MemberValuePairs();
break;
default:
jj_la1[166] = jj_gen;;
}
jj_consume_token(RPAREN);
{
if (true)
return new NormalAnnotationExpr(line, column, token.endLine, token.endColumn, name, pairs);
}
throw new Error("Missing return statement in function");
}
示例3: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, VisitorContext ctx) {
Object o = ctx.get(NODE_TO_COMPARE_KEY);
if (o != null && o instanceof NormalAnnotationExpr) {
NormalAnnotationExpr aux = (NormalAnnotationExpr) o;
boolean backup = isUpdated();
setIsUpdated(false);
inferASTChanges(n.getName(), aux.getName());
inferASTChanges(n.getPairs(), aux.getPairs());
if (!isUpdated()) {
increaseUnmodifiedNodes(NormalAnnotationExpr.class);
} else {
applyUpdate(n, aux, n.getPairs(), n.getPairs());
increaseUpdatedNodes(NormalAnnotationExpr.class);
}
setIsUpdated(backup || isUpdated());
} else if (o != null) {
setIsUpdated(true);
applyUpdate(n, (Node) o);
}
}
示例4: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, A arg) {
String type = n.getName().toString();
Symbol<?> s = symbolTable.lookUpSymbolForRead(type, n, ReferenceType.TYPE);
SymbolData sd = null;
if (s == null) {
// it is a full name and thus, it is not imported
sd = new SymbolType(type);
} else {
sd = s.getType();
}
n.setSymbolData(sd);
super.visit(n, arg);
}
示例5: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, A arg) {
if (semanticVisitor != null) {
n.accept(semanticVisitor, arg);
}
n.getName().accept(this, arg);
n.setSymbolData(n.getSymbolData());
}
示例6: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public R visit(NormalAnnotationExpr n, A arg) {
n.getName().accept(this, arg);
if (n.getPairs() != null) {
for (MemberValuePair m : n.getPairs()) {
m.accept(this, arg);
}
}
return null;
}
示例7: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public Boolean visit(NormalAnnotationExpr n1, Node arg) {
NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getPairs(), n2.getPairs())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例8: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
@Override
public Node visit(NormalAnnotationExpr _n, Object _arg) {
NameExpr name = cloneNodes(_n.getName(), _arg);
List<MemberValuePair> pairs = visit(_n.getPairs(), _arg);
NormalAnnotationExpr r = new NormalAnnotationExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(),
_n.getEndColumn(), name, pairs);
return r;
}
示例9: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, A arg) {
n.getName().accept(this, arg);
if (n.getPairs() != null) {
for (MemberValuePair m : n.getPairs()) {
m.accept(this, arg);
}
}
}
示例10: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, VisitorContext arg) {
if (preVisitor != null) {
preVisitor.visit(n, arg);
}
super.visit(n, arg);
if (postVisitor != null) {
postVisitor.visit(n, arg);
}
}
示例11: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public Node visit(NormalAnnotationExpr n, A arg) {
n.setName((NameExpr) n.getName().accept(this, arg));
List<MemberValuePair> pairs = n.getPairs();
if (pairs != null) {
for (int i = 0; i < pairs.size(); i++) {
pairs.set(i, (MemberValuePair) pairs.get(i).accept(this, arg));
}
removeNulls(pairs);
}
return n;
}
示例12: testAddImports
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
@Test
public void testAddImports() throws Exception {
String code = "package org;\npublic class A {}";
CompilationUnit modifiedCu = parser.parse(code, false);
CompilationUnit originalCu = parser.parse(code, false);
List<ImportDeclaration> imports = new LinkedList<ImportDeclaration>();
imports.add(new ImportDeclaration(new NameExpr("org.walkmod.B"), false, false));
modifiedCu.setImports(imports);
List<Action> actions = getActions(originalCu, modifiedCu);
Assert.assertEquals(1, actions.size());
Assert.assertEquals(ActionType.APPEND, actions.get(0).getType());
Assert.assertEquals(2, actions.get(0).getBeginLine());
Assert.assertEquals(1, actions.get(0).getBeginColumn());
assertCode(actions, code, "package org;\nimport org.walkmod.B;\npublic class A {}");
code = "package org;\[email protected]\npublic class A {}";
parser = new DefaultJavaParser();
modifiedCu = parser.parse(code, false);
originalCu = parser.parse(code, false);
imports = new LinkedList<ImportDeclaration>();
imports.add(new ImportDeclaration(new NameExpr("org.walkmod.B"), false, false));
modifiedCu.setImports(imports);
modifiedCu.getTypes().get(0).getAnnotations().add(0, new NormalAnnotationExpr(new NameExpr("Foo"), null));
actions = getActions(originalCu, modifiedCu);
Assert.assertEquals(2, actions.size());
Assert.assertEquals(ActionType.APPEND, actions.get(0).getType());
Assert.assertEquals(2, actions.get(0).getBeginLine());
Assert.assertEquals(1, actions.get(0).getBeginColumn());
assertCode(actions, code, "package org;\nimport org.walkmod.B;\[email protected]()\[email protected]\npublic class A {}");
}
示例13: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public R visit(NormalAnnotationExpr n, A arg);
示例14: visit
import org.walkmod.javalang.ast.expr.NormalAnnotationExpr; //导入依赖的package包/类
public void visit(NormalAnnotationExpr n, A arg);