Example usage for org.eclipse.jdt.core.dom MethodInvocation getStructuralProperty

List of usage examples for org.eclipse.jdt.core.dom MethodInvocation getStructuralProperty

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom MethodInvocation getStructuralProperty.

Prototype

public final Object getStructuralProperty(StructuralPropertyDescriptor property) 

Source Link

Document

Returns the value of the given structural property for this node.

Usage

From source file:org.eclipse.babel.tapiji.tools.java.util.ASTutils.java

License:Open Source License

public static boolean isMatchingMethodParamDesc(MethodInvocation methodInvocation, StringLiteral literal,
        MethodParameterDescriptor desc) {
    int keyParameter = desc.getPosition();
    boolean result = isMatchingMethodDescriptor(methodInvocation, desc);

    if (!result) {
        return false;
    }//from   w w  w  .  j av a2s .c om

    // Check position within method call
    StructuralPropertyDescriptor spd = literal.getLocationInParent();
    if (spd.isChildListProperty()) {
        @SuppressWarnings("unchecked")
        List<ASTNode> arguments = (List<ASTNode>) methodInvocation.getStructuralProperty(spd);
        result = (arguments.size() > keyParameter && arguments.get(keyParameter) == literal);
    }

    return result;
}