## org.springframework.aop.scope
Class DefaultScopedObject

    java.lang.Object
      org.springframework.aop.scope.DefaultScopedObject

All Implemented Interfaces:
  RawTargetAccess, ScopedObject

    public class DefaultScopedObject

extends Object
implements ScopedObject

Default implementation of the `ScopedObject` interface.

Simply delegates the calls to the underlying `bean factory` (`BeanFactory.getBean(String)`/ `ConfigurableBeanFactory.destroyScopedBean(String)`).

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `BeanFactory.getBean(java.lang.String)`, `ConfigurableBeanFactory.destroyScopedBean(java.lang.String)`

Constructor Summary
`DefaultScopedObject(ConfigurableBeanFactory beanFactory, String targetBeanName)` Creates a new instance of the `DefaultScopedObject` class.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultScopedObject

    public DefaultScopedObject(ConfigurableBeanFactory beanFactory,
                               String targetBeanName)

  Creates a new instance of the `DefaultScopedObject` class.

  Parameters:
    `beanFactory` - the `ConfigurableBeanFactory` that holds the scoped target object
    `targetBeanName` - the name of the target bean
  Throws:
    `IllegalArgumentException` - if either of the parameters is `null`; or if the `targetBeanName` consists wholly of whitespace

Method Detail

### getTargetObject

    public Object getTargetObject()

  Description copied from interface: `ScopedObject`
  Return the current target object behind this scoped object proxy, in its raw form (as stored in the target scope).

  The raw target object can for example be passed to persistence providers which would not be able to handle the scoped proxy object.

  Specified by:
    `getTargetObject` in interface `ScopedObject`
  Returns:
    the current target object behind this scoped object proxy

### removeFromScope

    public void removeFromScope()

  Description copied from interface: `ScopedObject`
  Remove this object from its target scope, for example from the backing session.

  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).

  Specified by:
    `removeFromScope` in interface `ScopedObject`

Copyright © 2002-2008 The Spring Framework.