public static boolean isMethodNamed ( MethodCallExpression methodCall , String methodNamePattern , Integer numArguments ) { Expression method = methodCall . getMethod ( ) ; // !important: performance enhancement boolean IS_NAME_MATCH = false ; if ( method instanceof ConstantExpression ) { if ( ( ( ConstantExpression ) method ) . getValue ( ) instanceof String ) { IS_NAME_MATCH = ( ( String ) ( ( ConstantExpression ) method ) . getValue ( ) ) . matches ( methodNamePattern ) ; } } if ( IS_NAME_MATCH && numArguments != null ) { return AstUtil . getMethodArguments ( methodCall ) . size ( ) == numArguments ; } return IS_NAME_MATCH ; }
Return true only if the MethodCallExpression represents a method call for the specified method name