public final class ServiceTracker extends Object
Tracker class to provide access to various framework implementation services. Examples of such services are:
SkinFactory
, TBD.
This class managess application-scoped service factories that are stored in the map with Thread.currentThread()
Context classloader as the key. Therefore, there is only one instance per JEE application in the current JVM.
actuall cal for the service instance delegated to the current factory
Note: in initial state this class is not synchronized and presumes that all modification operations are done in a context of single-thread (in JSF initialization listener).
Modifier and Type | Method and Description |
---|---|
static <T> T |
getProxy(Class<T> targetService)
Provides proxy which delegates to the given targetService interface once the method is invoked on the targetService.
|
static <T> T |
getService(Class<T> target)
Get service instance for given type. |
static <T> T |
getService(javax.faces.context.FacesContext context,
Class<T> target)
Get service instance for given type. |
static void |
release()
Release factory service associated with current context. |
static void |
setFactory(ServicesFactory factory)
Set service factory implementation for the current context. |
public static <T> T getService(Class<T> target)
Get service instance for given type. This is a wrapper method for getService(FacesContext, Class)
that gets
faces context by FacesContext.getCurrentInstance()
call, if needed.
T
- The service type, usually interface.target
- Service type class.public static <T> T getService(javax.faces.context.FacesContext context, Class<T> target)
Get service instance for given type.
T
- The service type, usually interface.context
- current FacesContext
.target
- Service type class.public static void setFactory(ServicesFactory factory)
Set service factory implementation for the current context.
factory
- public static void release()
Release factory service associated with current context.
public static <T> T getProxy(Class<T> targetService)
targetService
- the service to delegate operations toCopyright © 2015 JBoss by Red Hat. All Rights Reserved.