public static List < String > getArgumentNames ( MethodCallExpression methodCall ) { ArrayList < String > result = new ArrayList < String > ( ) ; Expression arguments = methodCall . getArguments ( ) ; List < Expression > argExpressions = null ; if ( arguments instanceof ArrayExpression ) { argExpressions = ( ( ArrayExpression ) arguments ) . getExpressions ( ) ; } else if ( arguments instanceof ListExpression ) { argExpressions = ( ( ListExpression ) arguments ) . getExpressions ( ) ; } else if ( arguments instanceof TupleExpression ) { argExpressions = ( ( TupleExpression ) arguments ) . getExpressions ( ) ; } else { LOG . warn ( "getArgumentNames arguments is not an expected type" ) ; } if ( argExpressions != null ) { for ( Expression exp : argExpressions ) { if ( exp instanceof VariableExpression ) { result . add ( ( ( VariableExpression ) exp ) . getName ( ) ) ; } } } return result ; }
Gets the argument names of a method call . If the arguments are not VariableExpressions then a null will be returned .