On 04/04/2012 02:00 PM, Vincent Massol wrote:
Hi Thomas/All,

All looks good except CM.lookupComponent() which Ï don't like a lot for the 
following reasons:
* It's a bit long. It's longer than before and it would be nicer if it were as 
short as before or even shorter ;)
* It's not symmetrical with other lookups like lookupList and lookupMap, which 
should theoretically be lookupComponentList() and lookupComponentMap() which 
are even longer

Thus I'd prefer that the new API for lookup be named differently.

I propose to use "resolve":

CM.resolve(Type)
CM.resolveList(Type)
CM.resolveMap(Type)

Alternative:

CM.getInstance(Type)
CM.getInstanceList(Type)
CM.getInstanceMap(Type)

or even the short:

CM.get(Type)
CM.getList(Type)
CM.getMap(Type)

For information Guice uses getInstance(), Picocontainer uses 
getComponentInstance().

WDYT?

My preference goes to getInstance():
* users are tempted by default to start typing "get" to get an instance and 
then they'll see getInstance in autocompletion and choose it.
* it's the same as Guice


Same, +1 for getInstance.

--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to