mercredi 8 janvier 2020

How can I map a field name of one class in java to another?

I want to refer a fieldname in one class of java to another. Ex: PageRequest.of(pageNumber, pageSize, Sort.by(Sort.Direction.DESC, "timestampCreate"));

Here 'timestampCreate' is field name of another class, say Employee. I do not want to hardcode and also want it to be future proof, in case the field name changes. Please suggest an idea. Thanks!





Aucun commentaire:

Enregistrer un commentaire