mardi 6 octobre 2020

Reflection - Get the size of List

Help me deal with reflection. There is a SuperClass class and a SomeClass:

public class SuperClass {
    private List<SomeClass> listClass;
    
    public SuperClass(){
        this.listClass = new ArrayList<>();
    }

    // ... getter and setter listClass
}

public class SomeClass {}

How can I use reflection to get the size of the listClass property of the SuperClass ? Preferably by calling the getListClass method.





Aucun commentaire:

Enregistrer un commentaire