lundi 9 octobre 2017

Use of Paranamer in gradle to generate parameter name data

I am trying to get parameter names of class inside my android application. to supply input to a help() method which will print all methods available and its parameter type and names. To get the parameter name, i am trying to use paranamer jar. I added paranamer.jar as a module library and i am able to import and use it. But have no idea on how to plug into gradle in order to generate parameter name data. Anyone any help ? Java code-

public void help() {
    Method[] declaredMethods = myclass.class.getDeclaredMethods();
    Paranamer paranamer = new CachingParanamer();
    for (Method declaredMethod : declaredMethods) {

        String[] parameterNames = paranamer.lookupParameterNames(declaredMethod, false);
//process paranamer.

    }
}

Thanks!





Aucun commentaire:

Enregistrer un commentaire