public class DefaultScopedObject extends java.lang.Object implements ScopedObject, java.io.Serializable
ScopedObject
interface.
Simply delegates the calls to the underlying
bean factory
(BeanFactory.getBean(String)
/
ConfigurableBeanFactory.destroyScopedBean(String)
).
BeanFactory.getBean(java.lang.String)
,
ConfigurableBeanFactory.destroyScopedBean(java.lang.String)
,
Serialized FormModifier and Type | Field and Description |
---|---|
private ConfigurableBeanFactory |
beanFactory |
private java.lang.String |
targetBeanName |
Constructor and Description |
---|
DefaultScopedObject(ConfigurableBeanFactory beanFactory,
java.lang.String targetBeanName)
Creates a new instance of the
DefaultScopedObject class. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getTargetObject()
Return the current target object behind this scoped object proxy,
in its raw form (as stored in the target scope).
|
void |
removeFromScope()
Remove this object from its target scope, for example from
the backing session.
|
private final ConfigurableBeanFactory beanFactory
private final java.lang.String targetBeanName
public DefaultScopedObject(ConfigurableBeanFactory beanFactory, java.lang.String targetBeanName)
DefaultScopedObject
class.beanFactory
- the ConfigurableBeanFactory
that holds the scoped target objecttargetBeanName
- the name of the target beanpublic java.lang.Object getTargetObject()
ScopedObject
The raw target object can for example be passed to persistence providers which would not be able to handle the scoped proxy object.
getTargetObject
in interface ScopedObject
public void removeFromScope()
ScopedObject
Note that no further calls may be made to the scoped object afterwards (at least within the current thread, that is, with the exact same target object in the target scope).
removeFromScope
in interface ScopedObject