本文整理汇总了Java中com.github.javaparser.ASTHelper.createNameExpr方法的典型用法代码示例。如果您正苦于以下问题:Java ASTHelper.createNameExpr方法的具体用法?Java ASTHelper.createNameExpr怎么用?Java ASTHelper.createNameExpr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ASTHelper
的用法示例。
在下文中一共展示了ASTHelper.createNameExpr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ASTHelper; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void visit(@Nullable MethodDeclaration methodDec,
@Nullable List<String> groupNames) {
if (null == methodDec || null == groupNames)
throw GlobalUtils
.createNotInitializedException("classorinterfacedeclaration");
else {
if (methodDec.getName().equals("runTest")) {
List<Expression> groups = new ArrayList<Expression>();
for (int i = 1; i < groupNames.size(); i++) {
groups.add(new StringLiteralExpr(groupNames.get(i)));
}
List<MemberValuePair> testAnnoParams = new ArrayList<MemberValuePair>();
testAnnoParams.add(new MemberValuePair("groups",
new ArrayInitializerExpr(groups)));
NormalAnnotationExpr testAnno = new NormalAnnotationExpr(
ASTHelper.createNameExpr("Test"), testAnnoParams);
methodDec.getAnnotations().add(testAnno);
}
}
}
示例2: createStatementExecuteBlock
import com.github.javaparser.ASTHelper; //导入方法依赖的package包/类
private BlockStmt createStatementExecuteBlock() {
BlockStmt block = new BlockStmt();
MethodCallExpr stmtExecute = new MethodCallExpr(ASTHelper.createNameExpr("stmt"), "execute");
ASTHelper.addArgument(stmtExecute, new StringLiteralExpr(createTableStatement));
ASTHelper.addStmt(block, stmtExecute);
return block;
}
示例3: visit
import com.github.javaparser.ASTHelper; //导入方法依赖的package包/类
public void visit(final BlockStmt n, final RoutingDefineContext arg) {
if (arg.isInRoutingDefine()) {
MethodCallExpr call = new MethodCallExpr(
ASTHelper.createNameExpr(arg.getRoutingParameter().getId().getName()),
"resource");
ReferenceType rt = ASTHelper.createReferenceType(controllerClassName, 0);
ASTHelper.addArgument(call, new ClassExpr(rt.getType()));
ASTHelper.addStmt(n, call);
} else {
super.visit(n, arg);
}
}