|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Scope
Strategy interface used by a ConfigurableBeanFactory
,
representing a target scope to hold beans in.
Provides the ability to get and put objects from whatever underlying
storage mechanism, such as HTTP session or request. The name passed into
this class's get
and put
methods will identify
the target attribute in the scope.
Scope
implementations are expected to be thread-safe.
One Scope
can be used with multiple bean factories, if desired.
Can be implemented on top of a session API such as the
Servlet API's HttpSession
interface.
ConfigurableBeanFactory.registerScope(java.lang.String, org.springframework.beans.factory.config.Scope)
,
ScopedProxyFactoryBean
,
HttpSession
Method Summary | |
---|---|
Object |
get(String name,
ObjectFactory objectFactory)
Return the object from the underlying scope, creating it if not found. |
String |
getConversationId()
Return the conversation id for the current underlying scope, if any. |
void |
registerDestructionCallback(String name,
Runnable callback)
Register a callback to be executed at destruction of the specified object (or at destruction of the entire scope, if the scope does not destroy individual objects but rather only terminate in its entirety). |
Object |
remove(String name)
Remove the object with the given name from the underlying scope. |
Method Detail |
---|
String getConversationId()
null
if there is no
conversation id concept for this scopeObject get(String name, ObjectFactory objectFactory)
name
- the name to bind withobjectFactory
- the ObjectFactory
used to create the scoped object if not present
Object remove(String name)
Returns 'null
' if no object was found; otherwise
returns the removed Object
.
name
- the name of the object to remove
void registerDestructionCallback(String name, Runnable callback)
Implementations should do their best to execute the callback at the appropriate time. If such a callback is not supported by the underlying runtime environment, the callback must be ignored and a corresponding warning should be logged.
name
- the name of the object to execute the destruction callback forcallback
- the destruction callback to be executed
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |