There is a class named "Foo" which normally contains more than 100 fields. It's a domain object and I have to customize it for each client because the fields' specification are almost totally different from one client to another (no more than 10 fields are same). Some clients have more than 200 fields.
Currently, I have to update the class definition of "Foo" in IDE as per the specification for each client. Because I have to use these fields in "Foo" to do some calculation in business layer, sometimes it is really error-prone and time-consuming.
I am wondering if someone knows any elegant way to do this? For example, I can write all the fields' definition (name, type, length, default value, scale, precision, calculation formula(mainly +-*/)) outside java code (suppose a xml file), then use a tool to generate the java source code. After that, I just compile and package the generated code as a foo-customized.jar and put it in my application.