mercredi 7 octobre 2015

Fields from type T

I want to get all the fields and it's values from an object of type T. Say I have:

public class Start {

    public void startMethod(){
        Main<GenericType> main = new Main<>();
        main.work(new GenericType());
    }

}

Then there's class Main, where I want the fields of GenericType:

public class Main<T> {

    public void work(T t){
        // Is there a way to get t's fields and values?
    }

}





Aucun commentaire:

Enregistrer un commentaire