getClass().getDeclaredFields().length
public class XXXDTO { private String name; private Integer age; private String address; }
int cnt = XXXDTO.class.getDeclaredFields().length; // return 3