I have a working form with multiple pages using Spring and Hibernate and need to report the progress of the fields completed thus far by the user (percentage of fields complete). Here are the options that I explored:
Option A) Check each property on the model for a value. If it's not null, increment a counter, then divide by the total number of properties checked.
Option B) Use reflection on the model object and call each getter. If it's not null, increment a counter, then divide by the total number of properties checked to get the completion percentage. I am thinking something along the lines of this post.
I know that Option B) will be more expensive to do and generally avoid reflection, but it may be easier to maintain when properties are added/removed.
Are there other options I'm missing? Maybe some type of bean utility where I can specifically exclude properties to check? (Or some clever use of BeanUtils?)