public class ContextManager extends Object implements ActiveContextProvider, ApplicationContextProvider
Context
manager allows to register local contexts for objects and manages the Application Context and the current Active Context.Constructor and Description |
---|
ContextManager()
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
Context |
getActiveContext()
Gets the active context.
|
Context |
getApplicationContext()
Gets the application-wide context.
|
LocalProxyContext |
getLocalContext(Object obj) |
void |
putLocalContext(Object obj)
Registers the local context of the given object if it implements
LocalContextProvider . |
void |
putLocalContext(Object obj,
LocalProxyContext context)
Registers a local context for the given Object.
|
LocalProxyContext |
removeLocalContext(Object obj)
Unregisters a local context.
|
void |
setLocalContextActive(Object obj)
Sets a local context active.
|
public Context getApplicationContext()
getApplicationContext
in interface ApplicationContextProvider
public Context getActiveContext()
getActiveContext
in interface ActiveContextProvider
public void setLocalContextActive(Object obj)
obj
- the object whose local context should be set activepublic void putLocalContext(Object obj, LocalProxyContext context)
obj
- an objectcontext
- the local context of the objectpublic void putLocalContext(Object obj)
LocalContextProvider
.
Its content will be available from the application-wide context and it can be set active afterwards.obj
- an objectpublic LocalProxyContext removeLocalContext(Object obj)
obj
- the object whose local context should be unregistered.public LocalProxyContext getLocalContext(Object obj)
Copyright © 2012–2018 Drombler. All rights reserved.