Recently, I worked on a user-friendly library which will provide users with a Resource object. This Resource object will be instantiated by my ResourceProvider/ ResourceManger/ResourceFactory, and ResourceProvider/ ResourceManger/ResourceFactory might have different implementations based on different context;
Besides, ResouceProvider/ResourceManager/ResourceFactory will have a cache across an application for Resource object based on the resource name.
ResourceManager mgr = ResourceManager.getInstance(context);
Resource r = mgr.getResource('myName')
My first thought is using a static factory method. My question is that what is the best pattern for this case. I think builder pattern is kind overkill since there is only one context parameter. Any idea is welcome!!
Aucun commentaire:
Enregistrer un commentaire