public class ProxyContext extends AbstractContext
Context which proxies other contexts.| Constructor and Description |
|---|
ProxyContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addContext(Context context)
Adds another
Context to be proxied by this context. |
<T> void |
addContextListener(Class<T> type,
ContextListener<T> listener)
Registers a
ContextListener for a specified type. |
void |
addContexts(List<Context> contexts) |
<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.
|
boolean |
isEmpty()
Indicates if this proxy has some contexts.
|
void |
removeContext(Context context)
Removes a
Context from being proxied by this context |
<T> void |
removeContextListener(Class<T> type,
ContextListener<T> listener)
Unregisters a
ContextListener for a specified type. |
void |
setContexts(Context... contexts)
Sets the contexts to be proxied by this context.
|
void |
setContexts(List<? extends Context> contexts)
Sets the contexts to be proxied by this context.
|
fireContextEvent, getListenerspublic <T> T find(Class<T> type)
T - the specified typetype - the specified typenull if no instance was
found.
TODO: return Optional?public <T> Collection<? extends T> findAll(Class<T> type)
T - 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 ContextaddContextListener in class AbstractContextT - 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 ContextremoveContextListener in class AbstractContextT - the specified typetype - the type to listen forlistener - the ContextListenerpublic void addContext(Context context)
Context to be proxied by this context.context - a Context to be proxiedpublic void removeContext(Context context)
Context from being proxied by this contextcontext - the context to removedpublic void setContexts(Context... contexts)
contexts - the contexts to be proxiedpublic void setContexts(List<? extends Context> contexts)
contexts - the contexts to be proxiedpublic boolean isEmpty()
Copyright © 2012–2018 Drombler. All rights reserved.