public abstract class ExposeBeanNameAdvisors
extends java.lang.Object
bean()
pointcut designator with AspectJ.
Typically used in Spring auto-proxying, where the bean name is known at proxy creation time.
NamedBean
Modifier and Type | Class and Description |
---|---|
private static class |
ExposeBeanNameAdvisors.ExposeBeanNameInterceptor
Interceptor that exposes the specified bean name as invocation attribute.
|
private static class |
ExposeBeanNameAdvisors.ExposeBeanNameIntroduction
Introduction that exposes the specified bean name as invocation attribute.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BEAN_NAME_ATTRIBUTE
Binding for the bean name of the bean which is currently being invoked
in the ReflectiveMethodInvocation userAttributes Map.
|
Constructor and Description |
---|
ExposeBeanNameAdvisors() |
Modifier and Type | Method and Description |
---|---|
static Advisor |
createAdvisorIntroducingNamedBean(java.lang.String beanName)
Create a new advisor that will expose the given bean name, introducing
the NamedBean interface to make the bean name accessible without forcing
the target object to be aware of this Spring IoC concept.
|
static Advisor |
createAdvisorWithoutIntroduction(java.lang.String beanName)
Create a new advisor that will expose the given bean name,
with no introduction
|
static java.lang.String |
getBeanName()
Find the bean name for the current invocation.
|
static java.lang.String |
getBeanName(MethodInvocation mi)
Find the bean name for the given invocation.
|
private static final java.lang.String BEAN_NAME_ATTRIBUTE
public static java.lang.String getBeanName() throws java.lang.IllegalStateException
null
)java.lang.IllegalStateException
- if the bean name has not been exposedpublic static java.lang.String getBeanName(MethodInvocation mi) throws java.lang.IllegalStateException
mi
- MethodInvocation that should contain the bean name as an attributenull
)java.lang.IllegalStateException
- if the bean name has not been exposedpublic static Advisor createAdvisorWithoutIntroduction(java.lang.String beanName)
beanName
- bean name to exposepublic static Advisor createAdvisorIntroducingNamedBean(java.lang.String beanName)
beanName
- the bean name to expose