public class LocalProxyContext extends Object implements Context
LocalContextProvider.
 Implicit local contexts may be provided by frameworks to associate additional content with an object.createLocalProxyContext(java.lang.Object)| Modifier and Type | Method and Description | 
|---|---|
| <T> void | addContextListener(Class<T> type,
                  ContextListener<T> listener)Registers a  ContextListenerfor a specified type. | 
| static LocalProxyContext | createLocalProxyContext(Object obj)Creates a new instance of this class for a given object. | 
| <T> T | find(Class<T> type)Finds an instance of the specified type in this context. | 
| <T> Collection<? extends T> | findAll(Class<T> type)Finds all instances of the specified type in this context. | 
| Context | getExplicitContext()Gets the explicit context (provided by a  LocalContextProvider. | 
| ProxyContext | getImplicitContext()Gets the implicit proxy context. | 
| boolean | hasExplicitContext()Indicates if this local context has an explicit context (provided by a  LocalContextProvider. | 
| boolean | hasImplicitContext()Indicates if this local context has some implicit contexts. | 
| <T> void | removeContextListener(Class<T> type,
                     ContextListener<T> listener)Unregisters a  ContextListenerfor a specified type. | 
public <T> T find(Class<T> type)
public <T> Collection<? extends T> findAll(Class<T> type)
findAll in interface ContextT - the specified typetype - the specified typeList instead of Collection? <T> instead of <? extends T>?public <T> void addContextListener(Class<T> type, ContextListener<T> listener)
ContextListener for a specified type.
 The listener will be notified when instances of the specified type get added or removed.addContextListener in interface ContextT - the specified typetype - the type to listen forlistener - the ContextListenerpublic <T> void removeContextListener(Class<T> type, ContextListener<T> listener)
ContextListener for a specified type.removeContextListener in interface ContextT - the specified typetype - the type to listen forlistener - the ContextListenerpublic ProxyContext getImplicitContext()
public Context getExplicitContext()
LocalContextProvider.public boolean hasImplicitContext()
public boolean hasExplicitContext()
LocalContextProvider.public static LocalProxyContext createLocalProxyContext(Object obj)
LocalContextProvider, the provided local context will be set as explicit context.
 Else an instance with no explicit context gets created.obj - the given object.Copyright © 2012–2018 Drombler. All rights reserved.