lundi 6 juin 2022

Springboot using reflection with stream

i would filter the result of my pagination result in springboot by iterating on all fields , i have the idea to iterate on each result and call each getter method of this object to compare it to my keyword (im doing smart search) , but i dont call each method hard coded cause the structure may change in fututr and there is a lot of feilds , i would to know how to pass each getters to stream

i already found how to get method with :

for(PropertyDescription Introspector.getBeanInfo(Myclass).getPropertyDescriptors()){
                  propertyDeescriptor.getReadMethod()}

thank you a lot





Aucun commentaire:

Enregistrer un commentaire