I'm currently refactoring a class which currently looks something like this:
class SomeModel {
private String displayName;
private int id;
private boolean editable;
private int minimumAllowedValue;
private int maximumAllowedValue;
private int value;
// etc. etc.... a bunch (10+) of other fields...
// and then tons of setters and getters for these fields, some of the
// setters have restrictions depending on other settings, like you can't
// set the maximum lower than the minimum, etc.
// ...
}
My question is: is this really the best way to go or should I refactor all these fields into more of a property-based structure (with simply two methods setProperty and getProperty)?
Another possible refactoring would be to extract "properties" belonging together into classes of their own, such as the max/min structure into an "AllowedRange" object or something.
Ideas?