samedi 25 avril 2015

How to implement a String like class which will have multiple non-equal instances

My implementation will consist of a java class representing a source repository. I want my implementation to be such that there will be only one object per source repository. If multiple instantiations are done per source repository, I want a unique object representing that source repository to be returned.

Are there any well known patterns/practices to achieve this?

Note : If the need was for only a unique object I would have using the Singleton pattern. In my scenario there can be multiple objects with no two objects representing the same source repository.

Aucun commentaire:

Enregistrer un commentaire