ch.elca.el4j.core.aop
Class ProxyEnricher

java.lang.Object
  extended by ch.elca.el4j.core.aop.ProxyEnricher

public class ProxyEnricher
extends Object

Used to enrich an existing proxy.

Author:
Martin Zeltner (MZE)
File-location:
ProxyEnricher
Last check-in date:
2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) by swismer for revision 3883

Constructor Summary
protected ProxyEnricher()
          Hide default constructor.
 
Method Summary
static Object enrichProxy(Class<?> beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource, String[] interceptorNames, BeanFactory beanFactory, AdvisorAdapterRegistry advisorAdapterRegistry, boolean applyCommonInterceptorsFirst)
          If the target of the given target source is already an advised object, then this proxy will be enriched with the known advisors.
protected static Object enrichProxyInternal(Class beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource, String[] interceptorNames, BeanFactory beanFactory, AdvisorAdapterRegistry advisorAdapterRegistry, boolean applyCommonInterceptorsFirst, Advised proxy)
          Enriches the given proxy instead of creating a new proxy.
static boolean isProxyEnrichable(Class<?> beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource, BeanFactory beanFactory)
          Tests if the given bean is a proxy and if it is possible to enrich it.
protected static Advisor[] resolveInterceptorNames(String[] interceptorNames, BeanFactory beanFactory, AdvisorAdapterRegistry advisorAdapterRegistry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyEnricher

protected ProxyEnricher()
Hide default constructor.

Method Detail

enrichProxy

public static Object enrichProxy(Class<?> beanClass,
                                 String beanName,
                                 Object[] specificInterceptors,
                                 TargetSource targetSource,
                                 String[] interceptorNames,
                                 BeanFactory beanFactory,
                                 AdvisorAdapterRegistry advisorAdapterRegistry,
                                 boolean applyCommonInterceptorsFirst)
If the target of the given target source is already an advised object, then this proxy will be enriched with the known advisors. If the enrichment failed, this method will return null.

Parameters:
beanClass - the class of the bean
beanName - the name of the bean
specificInterceptors - the set of interceptors that is specific to this bean (may be empty, but not null)
targetSource - the TargetSource for the proxy, already pre-configured to access the bean
interceptorNames - Are the names of interceptors to add to proxy too.
beanFactory - Is the bean factory.
advisorAdapterRegistry - Is the advisor adapter registry.
applyCommonInterceptorsFirst - Flag if common interceptors should be applied before the specific interceptors.
Returns:
Returns the enriched proxy or null if enrichment failed for some reason.

isProxyEnrichable

public static boolean isProxyEnrichable(Class<?> beanClass,
                                        String beanName,
                                        Object[] specificInterceptors,
                                        TargetSource targetSource,
                                        BeanFactory beanFactory)
Tests if the given bean is a proxy and if it is possible to enrich it.

Parameters:
beanClass - the class of the bean
beanName - the name of the bean
specificInterceptors - the set of interceptors that is specific to this bean (may be empty, but not null)
targetSource - the TargetSource for the proxy, already pre-configured to access the bean
beanFactory - Is the factory where to get beans.
Returns:
Returns true if the given bean is a proxy and if it is possible to enrich it.

enrichProxyInternal

protected static Object enrichProxyInternal(Class beanClass,
                                            String beanName,
                                            Object[] specificInterceptors,
                                            TargetSource targetSource,
                                            String[] interceptorNames,
                                            BeanFactory beanFactory,
                                            AdvisorAdapterRegistry advisorAdapterRegistry,
                                            boolean applyCommonInterceptorsFirst,
                                            Advised proxy)
Enriches the given proxy instead of creating a new proxy.

Parameters:
beanClass - the class of the bean
beanName - the name of the bean
specificInterceptors - the set of interceptors that is specific to this bean (may be empty, but not null)
targetSource - the TargetSource for the proxy, already pre-configured to access the bean
interceptorNames - Are the names of interceptors to add to given proxy too.
beanFactory - Is the bean factory.
advisorAdapterRegistry - Is the advisor adapter registry.
applyCommonInterceptorsFirst - Flag if common interceptors should be applied before the common interceptors.
proxy - Is the proxy (advised) to enrich.
Returns:
Returns the enriched proxy.
See Also:
#createProxy(Class, String, Object[], TargetSource)

resolveInterceptorNames

protected static Advisor[] resolveInterceptorNames(String[] interceptorNames,
                                                   BeanFactory beanFactory,
                                                   AdvisorAdapterRegistry advisorAdapterRegistry)
Parameters:
interceptorNames - Are the interceptor names to resolve.
beanFactory - Is the used bean factory.
advisorAdapterRegistry - Is the used advisor adapter registry.
Returns:
Resolves the specified interceptor names to Advisor objects.
See Also:
AbstractAutoProxyCreator.resolveInterceptorNames()


Copyright © 2005-2011 ELCA. All Rights Reserved.