本文整理汇总了Java中org.codehaus.groovy.ast.expr.MethodCallExpression.setArguments方法的典型用法代码示例。如果您正苦于以下问题:Java MethodCallExpression.setArguments方法的具体用法?Java MethodCallExpression.setArguments怎么用?Java MethodCallExpression.setArguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.ast.expr.MethodCallExpression
的用法示例。
在下文中一共展示了MethodCallExpression.setArguments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryMacroMethod
import org.codehaus.groovy.ast.expr.MethodCallExpression; //导入方法依赖的package包/类
/**
* Attempts to call given macroMethod
* @param call MethodCallExpression before the transformation
* @param macroMethod a macro method candidate
* @param macroArguments arguments to pass to
* @return true if call succeeded and current call was transformed
*/
private boolean tryMacroMethod(MethodCallExpression call, ExtensionMethodNode macroMethod, Object[] macroArguments) {
Expression result = (Expression) InvokerHelper.invokeStaticMethod(
macroMethod.getExtensionMethodNode().getDeclaringClass().getTypeClass(),
macroMethod.getName(),
macroArguments
);
if (result == null) {
// Allow macro methods to return null as an indicator that they didn't match a method call
return false;
}
call.setObjectExpression(MACRO_STUB_INSTANCE);
call.setMethod(new ConstantExpression(MACRO_STUB_METHOD_NAME));
// TODO check that we reset everything here
call.setSpreadSafe(false);
call.setSafe(false);
call.setImplicitThis(false);
call.setArguments(result);
call.setGenericsTypes(new GenericsType[0]);
return true;
}
示例2: handleTargetMethodCallExpression
import org.codehaus.groovy.ast.expr.MethodCallExpression; //导入方法依赖的package包/类
@Override
protected boolean handleTargetMethodCallExpression(MethodCallExpression call) {
ClosureExpression closureExpression = getClosureArgument(call);
List<Expression> otherArgs = getNonClosureArguments(call);
String source = convertClosureToSource(closureExpression);
// parameter order is build(CompilePhase, boolean, String)
otherArgs.add(new ConstantExpression(source));
call.setArguments(new ArgumentListExpression(otherArgs));
call.setMethod(new ConstantExpression("buildFromBlock"));
call.setSpreadSafe(false);
call.setSafe(false);
call.setImplicitThis(false);
return false;
}
示例3: transformMethodCall
import org.codehaus.groovy.ast.expr.MethodCallExpression; //导入方法依赖的package包/类
private Expression transformMethodCall(MethodCallExpression mce, Expression args) {
ClassNode classType;
if (isNewMethodStyle(mce)) {
classType = mce.getObjectExpression().getType();
} else {
classType = findMatchingCandidateClass(mce);
}
if (classType != null) {
return new ConstructorCallExpression(classType, args);
}
// set the args as they might have gotten Newify transformed GROOVY-3491
mce.setArguments(args);
return mce;
}