1

How can I get the name of argument in aspect, for example if my method is test(Sample sampleDto), I need know the name of sampleDto in my aspect. How get it from ProceedingJoinPoint ? I try this, but I get null.

String[] argumentsName = ((MethodSignature) proceedingJoinPoint.getSignature()).getParameterNames()
Hamid
  • 153
  • 1
  • 2
  • 9

1 Answers1

0

Just tried this and it worked

Reporter.log(gson.toJson(((MethodSignature) jp.getSignature()).getParameterNames()), true);
Reporter.log(gson.toJson(jp.getArgs()), true);

Output

[
  "externalOrderId",
  "tenderDto",
  "checksum",
  "cookieToken"
]
[
  "C605600399",
  {
    "number": "XXXXXXXXXXXXXXXX",
    "expiration": "XXXXXX",
    "pin": "XXX",
    "type": "CREDITCARD"
  },
  1514412484857,
  "50113963101%2CP08rS1wzJiYqQEA3ODEkQVZWLy8sTksmMyNPJH4mXj0jQi1KOThfTld%2BQCQh"
]
Lenar
  • 419
  • 4
  • 19