org.springframework.aop.scope.ScopedObject Maven / Gradle / Ivy
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.scope;
import org.springframework.aop.RawTargetAccess;
/**
* An AOP introduction interface for scoped objects.
*
* Objects created from the {@link ScopedProxyFactoryBean} can be cast
* to this interface, enabling access to the raw target object
* and programmatic removal of the target object.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 2.0
* @see ScopedProxyFactoryBean
*/
public interface ScopedObject extends RawTargetAccess {
/**
* 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.
* @return the current target object behind this scoped object proxy
*/
Object getTargetObject();
/**
* 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).
*/
void removeFromScope();
}