kendal.api.impl.builders.MethodInvocationBuilderImpl Maven / Gradle / Ivy
The newest version!
package kendal.api.impl.builders;
import java.util.Collections;
import java.util.List;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
import com.sun.tools.javac.tree.TreeMaker;
import kendal.api.AstUtils;
import kendal.api.builders.MethodInvocationBuilder;
import kendal.model.Node;
import kendal.model.TreeBuilder;
public class MethodInvocationBuilderImpl extends AbstractBuilder implements MethodInvocationBuilder {
public MethodInvocationBuilderImpl(AstUtils astUtils, TreeMaker treeMaker) {
super(astUtils, treeMaker);
}
@Override
public Node build(Node method) {
return build(method, com.sun.tools.javac.util.List.nil());
}
@Override
public Node build(Node method,
List> parameters) {
return build(method, astUtils.mapNodesToJCListOfObjects(parameters));
}
@Override
public Node build(Node method,
Node parameter) {
return build(method, Collections.singletonList(parameter));
}
@Override
public Node build(Node method,
com.sun.tools.javac.util.List parameters) {
JCMethodInvocation jcMethodInvocation = treeMaker.App(method.getObject(),
(com.sun.tools.javac.util.List) parameters);
return TreeBuilder.buildNode(jcMethodInvocation);
}
}