How to get method signature

The sonarqube version used is 7.7.
I am trying to create a custom rule for which I need the method signature. Currently using visitMethod() but not able to get the required output. The example below will help in understanding what I am trying to achieve.

public ResponseEntity<List<EmployeeEntity>>getAllEmployees**(@RequestParam(defaultValue = "0") Integer pageNo,@RequestParam(defaultValue = "10") Integer limit){
}

I am trying to get the method signature till getAllEmpployees which i am not able to using visitMethod. please suggest how to do.
And also how to get the entire parameters including default value.

(@RequestParam(defaultValue = "0") Integer pageNo,@RequestParam(defaultValue = "10") Integer limit)

Hello @sevenugo, welcome to the community!

First, I advise you to have a careful look at Writing Custom Java Rules 101.

To answer your question, the method visitMethod(MethodTree tree) has a MethodTree as argument, you will find everything you need inside this object. I believe the method names of this object are clear enough, for example, you will find ResponseEntity<List<EmployeeEntity>> inside the returnType, and the annotation containing the default value inside the modifiers of the VariableTree. (that you can find inside FormalParameterList).

Feel free to get back to us if you still have questions.

Best,
Quentin