vendredi 5 mai 2017

Java Generic Factory pattern implementation

What I am trying to do, is implementig a clickstream data generator, that can be extended in a nice way.

What I was thinking of:

The properties are Classes, e.g. each user has some kind of browser. So there is a browser class. Same for language, plugins etc....

For each Property there is a Factory that creates me a random instance of a Property e.g. new Browser("Firefox") or new Language("German"). The possible values are stored in a file for each property.

Basically all these factories and property classes are doing the same thing. Right now i have a seperate factory for each property and for each new porperty i have to generate a new factory.

My Question is, is there a possibility to implement some kind of generic factory for all the properties i have, and for new ones to come

Aucun commentaire:

Enregistrer un commentaire