01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.aop.framework.autoproxy;
18:
19: /**
20: * Holder for the current proxy creation context, as exposed by auto-proxy creators
21: * such as {@link AbstractAdvisorAutoProxyCreator}.
22: *
23: * @author Juergen Hoeller
24: * @author Ramnivas Laddad
25: * @since 2.5
26: */
27: public class ProxyCreationContext {
28:
29: /** ThreadLocal holding the current proxied bean name during Advisor matching */
30: private static final ThreadLocal currentProxiedBeanName = new ThreadLocal();
31:
32: /**
33: * Return the name of the currently proxied bean instance.
34: * @return the name of the bean, or <code>null</code> if none available
35: */
36: public static String getCurrentProxiedBeanName() {
37: return (String) currentProxiedBeanName.get();
38: }
39:
40: /**
41: * Set the name of the currently proxied bean instance.
42: * @param beanName the name of the bean, or <code>null</code> to reset it
43: */
44: static void setCurrentProxiedBeanName(String beanName) {
45: currentProxiedBeanName.set(beanName);
46: }
47:
48: }
|