vendredi 24 septembre 2021

Extract the default argument value in method

I am trying to create a UI to test a scala interface. To do so, I am extracting all the declared methods from the interface using java reflection. I am able to get the method names via

Class[MyClass].getDeclaredMethods.map(_.getName)

I am also able to extract all the parameter names and types via:

val paramNames = method.getParameters.map(_.getName)
val paramType = param.getParameterizedType.getTypeName

Now I am also trying to extract any default value of a parameter if there are any. However, I couldn't find a way to do so yet.





Aucun commentaire:

Enregistrer un commentaire