本文整理汇总了Java中com.github.javaparser.ast.expr.MethodCallExpr.getArgs方法的典型用法代码示例。如果您正苦于以下问题:Java MethodCallExpr.getArgs方法的具体用法?Java MethodCallExpr.getArgs怎么用?Java MethodCallExpr.getArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.expr.MethodCallExpr
的用法示例。
在下文中一共展示了MethodCallExpr.getArgs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseMethodCallExpression
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
/**
*
* @param mcEx
* a github javaparser MethodCallExpression
* @param attributes
* the list of attributes of the class,
* to potentially get a type from the name
* @param lineNumber
* the starting line number of the parse method or constructor
* @return
* a CallExpression structure
*/
private CallExpression parseMethodCallExpression(MethodCallExpr mcEx, List<Attribute> attributes, int lineNumber) {
CallExpression callExpr = new CallExpression();
FuncRef funcRef = new FuncRef();
funcRef.setFuncName(mcEx.getName());
if (mcEx.getScope() != null) {
funcRef.setNamespace(mcEx.getScope().toString());
}
callExpr.setFunction(funcRef);
List<Expr> arguments = new ArrayList<>();
if (mcEx.getArgs() != null) {
for (Expression expr : mcEx.getArgs()) {
arguments.add(parseExpression(expr, attributes, lineNumber));
}
}
callExpr.setArguments(arguments);
callExpr.setLine(mcEx.getBeginLine() - lineNumber);
return callExpr;
}
示例2: visit
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
@Override public Node visit(final MethodCallExpr n, final A arg) {
if (n.getScope() != null) {
n.setScope((Expression) n.getScope().accept(this, arg));
}
final List<Type> typeArgs = n.getTypeArgs();
if (typeArgs != null) {
for (int i = 0; i < typeArgs.size(); i++) {
typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg));
}
removeNulls(typeArgs);
}
final List<Expression> args = n.getArgs();
if (args != null) {
for (int i = 0; i < args.size(); i++) {
args.set(i, (Expression) args.get(i).accept(this, arg));
}
removeNulls(args);
}
return n;
}
示例3: visit
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
@Override public void visit(final MethodCallExpr n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getScope() != null) {
n.getScope().accept(this, arg);
}
if (n.getTypeArguments() != null) {
for (final Type t : n.getTypeArguments()) {
t.accept(this, arg);
}
}
n.getNameExpr().accept(this, arg);
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
}
示例4: visit
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
@Override public Node visit(final MethodCallExpr n, final A arg) {
visitComment(n, arg);
if (n.getScope() != null) {
n.setScope((Expression) n.getScope().accept(this, arg));
}
final List<Type<?>> typeArguments = n.getTypeArguments();
if (typeArguments != null) {
for (int i = 0; i < typeArguments.size(); i++) {
typeArguments.set(i, (Type<?>) typeArguments.get(i).accept(this, arg));
}
removeNulls(typeArguments);
}
final List<Expression> args = n.getArgs();
if (args != null) {
for (int i = 0; i < args.size(); i++) {
args.set(i, (Expression) args.get(i).accept(this, arg));
}
removeNulls(args);
}
return n;
}
示例5: visit
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
@Override
public JCTree visit(final MethodCallExpr n, final Object arg) {
//ARG0: List<JCExpression> typeargs
List<JCExpression> arg0 = List.<JCExpression>nil();
if (n.getTypeArgs() != null) {
for (final com.github.javaparser.ast.type.Type t : n.getTypeArgs()) {
arg0 = arg0.append((JCExpression) t.accept(this, arg));
}
}
//ARG1: JCExpression fn
JCFieldAccess arg1;
JCExpression selected = null;
if (n.getScope() != null) {
selected = (JCExpression) n.getScope().accept(this, arg);
}
arg1 = new AJCFieldAccess(make.Select(selected, names.fromString(n.getName())), null);
//ARG2: List<JCExpression> args
List<JCExpression> arg2 = List.<JCExpression>nil();
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
arg2 = arg2.append((JCExpression) e.accept(this, arg));
}
}
return new AJCMethodInvocation(make.Apply(arg0, arg1, arg2), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例6: addArgument
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
/**
* Adds the given argument to the method call. The list of arguments will be
* initialized if it is <code>null</code>.
*
* @param call
* method call
* @param arg
* argument value
*/
public static void addArgument(MethodCallExpr call, Expression arg) {
List<Expression> args = call.getArgs();
if (isNullOrEmpty(args)) {
args = new ArrayList<Expression>();
call.setArgs(args);
}
args.add(arg);
}
示例7: addArgument
import com.github.javaparser.ast.expr.MethodCallExpr; //导入方法依赖的package包/类
/**
* Adds the given argument to the method call. The list of arguments will be
* initialized if it is <code>null</code>.
*
* @param call
* method call
* @param arg
* argument value
*/
public static void addArgument(MethodCallExpr call, Expression arg) {
List<Expression> args = call.getArgs();
if (args == null) {
args = new ArrayList<Expression>();
call.setArgs(args);
}
args.add(arg);
}