How to use Class getMethod with lombok @Data

Tags: , , ,

I am trying to call Class getMethod() method with lombok @Data to call getter of model but i got NoSuchMethod exception. Below are my classes:

Model class:

public class Claim {
    private String customerName;


Claim.class.get("getCustomerName", String.class)


Method threw 'java.lang.NoSuchMethodException' exception.


You can use below code:

new PropertyDescriptor("customerName", claim.getClass()).getReadMethod().invoke(claim)

for better explaination click here

Source: stackoverflow