All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.apex.ast.ASTMethodCallExpression Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
/*
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.apex.ast;

import java.util.List;
import java.util.stream.Collectors;

import com.google.summit.ast.Identifier;
import com.google.summit.ast.expression.CallExpression;


public final class ASTMethodCallExpression extends AbstractApexNode.Single {

    /**
     * The {@link Identifier}s that constitute the {@link CallExpression#getReceiver() receiver} of
     * this method call.
     */
    private final List receiverComponents;

    ASTMethodCallExpression(CallExpression callExpression, List receiverComponents) {
        super(callExpression);
        this.receiverComponents = receiverComponents;
    }


    @Override
    protected  R acceptApexVisitor(ApexVisitor visitor, P data) {
        return visitor.visit(this, data);
    }

    public String getMethodName() {
        return node.getId().getString();
    }

    public String getFullMethodName() {
        return receiverComponents.stream().map(id -> id.getString() + ".").collect(Collectors.joining()) + getMethodName();
    }

    public int getInputParametersSize() {
        return node.getArgs().size();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy