|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.utah.further.core.api.context.Bordello
@Utility @Api @Deprecated public final class Bordello
A provider of services that implements the generic service locator pattern. Service implementations are assumed to have a public no-argument constructor.
Personally, I feel this approach is inferior to DI, except perhaps in case of injecting
services into domain entities. In that case, using a static Bordello
method in
contrast to Spring's Configurable
annotation may be simpler, as it does
not require any start-up initialization overhead of the Spring framework, and does not
require a JVM javaagent that may be needed to be reserved for something else (e.g.
performance testing agents). On the other hand, Bordello
has many
disadvantages, e.g. the default implementation must be declared in a maven API module
rather than hidden from clients in a maven implementation module.
In sum, use Bordello
for simple DI cases. It will be faster than LTW. Use LTW
with Configurable
to minimize dependencies between API and implementation
modules, and when performance is not super-critical.
-----------------------------------------------------------------------------------
(c) 2008-2011 FURTHeR Project, AVP Health Sciences IT Office, University of Utah
Contact: Dr. Scott Narus <scott.narus@hsc.utah.edu>
Biomedical Informatics, 26 South 2000 East
Room 5775 HSEB, Salt Lake City, UT 84112
Day Phone: 1-801-213-3288
-----------------------------------------------------------------------------------
<oren.livne@utah.edu>
http://www.artima.com/weblogs/viewpost.jsp?thread=238562
Method Summary | ||
---|---|---|
static
|
getService(Class<T> interfaceClass)
Deprecated. Acquire an implementation of a service. |
|
static
|
setService(Class<T> interfaceClass,
T provider)
Deprecated. Set an alternate service implementation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T getService(Class<T> interfaceClass)
T
- service interface typeinterfaceClass
- service interface class
public static <T> void setService(Class<T> interfaceClass, T provider)
T
- service interface typeinterfaceClass
- service interface classprovider
- service implementation class to set as the one returned from
getService(Class)
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |