This content has been marked as final.
Show 1 reply
-
1. Re: Howto make an "easy to use" bean connector class?
jwkaltz Feb 21, 2002 2:47 AM (in response to nikolaj)If you use a ServiceLocator, than you've already hidden most of the complexity.
See (for example) java.sun.com for the ServiceLocator pattern.
You can of course encapsulate as much or as little as you want, but my personal preference is to encapsulate the lookups in a ServiceLocator (thereby allowing to cache the home interfaces, as the lookups are quite expensive), so in the end you have something like
MrBeanLocalHome home = (MrBeanLocalHome) ServiceLocator.getResource("MrBean");
MrBeanLocal mrbean = home.create();
I wouldn't hide the create() part because you're not gaining much but you're losing in code transparency.