For logging in the remote server I constantly need to print the parameters of a method to see if this method getting correct parameter.
Is there a way to print all method parameter (if they are object then with toString
) in one shot. For example:
void doSomething(String anyString, Object anyObject)
{
System.out.println("anyString : "+anyString+" anyObject: "+anyObject.toString());
// I want to generate above line in one shot.
}
Option 1:
Source Generator :
We use source generator to generate toString
equals()
hashCode()
using class variable. SO, is there any way to add another option in source generator to support this.?
Option 2: Using Template :
we write some code block using suggested snippet. like foreach
, while
, try-catch
.
Note: I tried adding a custom template for this purpose, but i was just able to print the parameters name using ${enclosing_method_arguments}
. Is there any way to use this?
Option 3: Our Suggestion .