Example usage for com.google.gwt.dev.jjs.ast JMethodCall getTarget

List of usage examples for com.google.gwt.dev.jjs.ast JMethodCall getTarget

Introduction

In this page you can find the example usage for com.google.gwt.dev.jjs.ast JMethodCall getTarget.

Prototype

public JMethod getTarget() 

Source Link

Usage

From source file:rocket.logging.compiler.LoggerOptimiser.java

License:Apache License

@Override
public void endVisit(final JMethodCall methodCall, final Context context) {
    while (true) {
        final JMethod method = methodCall.getTarget();
        // its definitely not the LoggerFactory.getLogger(String) method...
        if (method != this.getGetLogger()) {
            break;
        }/*w  w w  . j  a v a  2 s . c  o  m*/

        // complain if the method doesnt have exactly 1 argument...
        assert (methodCall.getArgs().size() == 1);

        // check if the argument to the method is a string literal...
        final JExpression arg = (JExpression) methodCall.getArgs().get(0);

        // cant continue if argument is not a StringLiteral... this request
        // will have to be resolved at runtime.
        if (false == arg instanceof JStringLiteral) {
            break;
        }

        this.adjustMethod(methodCall, context);
        break;
    }
}