I am having a hard time trying to make this work. I will try to be as quick and simple as possible using examples.
I have 3 classes: Table, Entity1 and Entity2. E1 and E2 extends from Table. They are all clases to interact with a Database. So, they have getSchema() method.
My idea was to have the fields in a List in Entity1 and Entity2, and having the getSchema() method in Table, looping through the list, adding some common fields to all tables, and generating the Schema.
This would work as a Template Method, the problem is that I need getSchema() to be static, since I need to call it a few times and I dont want to generate the schema everytime. This is an important condition since performance is key in this use case.
I tried different approaches but nothing seems to work on this case.
Any suggestions?
Aucun commentaire:
Enregistrer un commentaire