Example usage for org.eclipse.jdt.core.dom StringLiteral getLocationInParent

List of usage examples for org.eclipse.jdt.core.dom StringLiteral getLocationInParent

Introduction

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

Prototype

public final StructuralPropertyDescriptor getLocationInParent() 

Source Link

Document

Returns the location of this node within its parent, or null if this is a root 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 .  ja v a2s  .c  o m

    // 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;
}