Hey,
I am dealing with quite a lot of classes that often use List<String> to capture generic lists of text information from users, e.g. a list of names or a list of risks or a list of thoughts. The values being captures don't need to be modeled in any more detail than a String, so I wouldn't want to have List<Name>, List<Risk> or List<Thought> for example.
The List<String> properties appear all over my class hierarchy and quite often a single model class will contain 2 or more of these kinds of properties, so for example
Code:
class Person {
List<String> dreams;
List<String> playedInstruments;
List<String> favouriteFoods;
}
I wondered if there is an accepted mapping strategy for these kinds of things.
I can only imagine needing to create one to many join tables for each property which would work but seems verbose. I can't use one single table for strings because as shown sometimes a class ID will map to many strings for different properties.
I suppose I could also turn each property into a single String and CSV them and explode/implode but that seems also like it would need lots of code to do throughout all my classes.
If anyone has suggestions or knows that I should do it one way or the other then great. I guess I'd just like some validation of how I should tackle this, verbose or not.
Thanks!